Example #1
0
    def ParseXMLNode(self, mineDataNode):
        """
      Generate Mine Data Manager data from xml tree node. 
      """

        # Location
        if (HasChild(mineDataNode, "Location")):
            locNode = GetChild(mineDataNode, "Location")
            self.mineLatLong[0] = GetAttributeValue(locNode, "lat")
            self.mineLatLong[1] = GetAttributeValue(locNode, "long")

        # Orebody
        if (HasChild(mineDataNode, "Orebody")):
            orebodyNode = GetChild(mineDataNode, "Orebody")
            self.theOreBody.ParseXMLNode(orebodyNode)

        theFunctionManager = FunctionManager()
        if ((self.theOreBody.cover < 0.0)
                and (theFunctionManager.HasFunction("DepthOfCover"))):
            self.theOreBody.cover = theFunctionManager.GetFunction(
                "DepthOfCover").f(self.mineLatLong)
            print "Cover set to: ", self.theOreBody.cover

        # Infrastructure
        if (HasChild(mineDataNode, "Infrastructure")):
            infrastructureNode = GetChild(mineDataNode, "Infrastructure")
            self.theInfrastructureManager.ParseXMLNode(infrastructureNode)

        # Economics
        if (HasChild(mineDataNode, "Economics")):
            economicsNode = GetChild(mineDataNode, "Economics")
            self.theEconomicDataManager.ParseXMLNode(economicsNode)
 def ParseXMLNode(self, mineDataNode):
   """
   Generate Mine Data Manager data from xml tree node. 
   """
   
   # Location
   if(HasChild(mineDataNode,"Location")):
     locNode = GetChild(mineDataNode,"Location")
     self.mineLatLong[0] = GetAttributeValue(locNode,"lat")
     self.mineLatLong[1] = GetAttributeValue(locNode,"long")
   
   # Orebody
   if(HasChild(mineDataNode,"Orebody")):
     orebodyNode = GetChild(mineDataNode,"Orebody")
     orebodyName = GetAttributeStringOrDefault(orebodyNode,"name","unnamed")
     self.theOrebodies[orebodyName] = OreBodyDataManager(orebodyName)
     self.theOrebodies[orebodyName].ParseXMLNode(orebodyNode)
     self.theOrebodies["Active"] = self.theOrebodies[orebodyName]
     self.theOreBody = self.theOrebodies[orebodyName]
     self.theMines[orebodyName] = MiningSystemDataManager(orebodyName)
     self.theMiningSystem = self.theMines[orebodyName]
     
   # Orebody Set
   if(HasChild(mineDataNode,"OrebodyList")):
     orebodyList = GetChild(mineDataNode,"OrebodyList")
     setActive = True
     for orebodyNode in GetChildren(orebodyList):
     
       if(GetXMLTag(orebodyNode) != "note"):
         
         orebodyName = GetAttributeString(orebodyNode,"name")
         self.theOrebodies[orebodyName] = OreBodyDataManager(orebodyName)
         self.theOrebodies[orebodyName].latLong = np.array(self.mineLatLong)  # set global lat long as orebody lat long as default
         self.theOrebodies[orebodyName].ParseXMLNode(orebodyNode)
       
         self.theMines[orebodyName] = MiningSystemDataManager(orebodyName)
       
         if(setActive):
           self.theOrebodies["Active"] = self.theOrebodies[orebodyName]
           self.theOreBody = self.theOrebodies[orebodyName]
           self.theMiningSystem = self.theMines[orebodyName]
           setActive = False
         
       
   
   theFunctionManager = FunctionManager()
   if( (self.theOreBody.cover < 0.0 ) and (theFunctionManager.HasFunction("DepthOfCover") ) ):
     self.theOreBody.cover = theFunctionManager.GetFunction("DepthOfCover").f( self.mineLatLong[::-1]  )
     print("Cover set to: ", self.theOreBody.cover )
     
     
   
   if(HasChild(mineDataNode,"Mining")):
     miningNode = GetChild(mineDataNode,"Mining")
     # pass XML settings to all orebodies
     self.theMines["Active"].ParseXMLNode(miningNode)
     for orebodyName in self.theOrebodies:
       self.theMines[orebodyName].ParseXMLNode(miningNode)
     
   # Infrastructure
   if(HasChild(mineDataNode,"Infrastructure")):
     infrastructureNode = GetChild(mineDataNode,"Infrastructure")
     self.theInfrastructureManager.ParseXMLNode(infrastructureNode)      
 
   # Rehabilitation
   if(HasChild(mineDataNode,"Rehabilitation")):
     rehabNode = GetChild(mineDataNode,"Rehabilitation")
     self.theRehabilitationManager = RehabilitationDataManager()
     self.theRehabilitationManager.ParseXMLNode(rehabNode)    
     
   # Economics
   if(HasChild(mineDataNode,"Economics")):
     economicsNode = GetChild(mineDataNode,"Economics")
     self.theEconomicDataManager.ParseXMLNode(economicsNode)