protected override void SetModelVisibility(CPipeModel pipeModel, bool bVisible)
 {
     CFillModel fillModel = pipeModel.FillModel;
     foreach (CFillSegment segment in fillModel.Segments)
     {
         segment.ModelNode.Visibility = bVisible;
     }
     IApp.theApp.RenderScene();
 }
        protected override bool GetModelVisibility(CPipeModel pipeModel)
        {
            CFillModel fillModel = pipeModel.FillModel;

            bool bFillModelVisible = false;
            foreach (CFillSegment segment in fillModel.Segments)
            {
                if (segment.ModelNode.Visibility)
                {
                    bFillModelVisible = true;
                    break;
                }
            }

            return bFillModelVisible;
        }
Esempio n. 3
0
 public CCableSystem(CPipeModel pipeModel)
     : base(pipeModel)
 {
     m_pPipeModel = pipeModel;
 }
 private void CacheFinalPipeInfoForFinishedPipe(CPipeModel pipeModel, int iPipeIndex)
 {
     // Cache the final pipe info
     // I think every time to query the pipe info really cost a lot
     if (pipeModel.FinalPipeInfo == null)
     {
         try
         {
             // Find the final pipe info this pipe model
             IHistoryDataQuery historyDataQuery = IApp.theApp.HistoryTimeDataQuery;
             PipeInfo lastPipeInfo = historyDataQuery.GetPipeRecord(historyDataQuery.GetPipeEndTime(iPipeIndex, true), true);
             if (lastPipeInfo != null)
             {
                 // Cache it
                 pipeModel.FinalPipeInfo = lastPipeInfo;
             }
         }
         catch (Exception ex)
         {
             string errMsg = ex.Message + "\n" + ex.StackTrace;
             vtk.vtkOutputWindow.GetInstance().DisplayErrorText(errMsg);
         }
     }
 }
 protected override void SetModelVisibility(CPipeModel pipeModel, bool bVisible)
 {
     CZhujiangModel zhujiangModel = pipeModel.ZhujiangModel;
     zhujiangModel.ModelNode.Visibility = bVisible;
     IApp.theApp.RenderScene();
 }
 protected override ISceneNode GetModel(CPipeModel pipeModel)
 {
     return pipeModel.ZhujiangModel;
 }
        protected override bool GetModelVisibility(CPipeModel pipeModel)
        {
            CZhujiangModel zhujiangModel = pipeModel.ZhujiangModel;

            bool bFillModelVisible = zhujiangModel.ModelNode.Visibility;
            return bFillModelVisible;
        }
 protected override ISceneNode GetModel(CPipeModel pipeModel)
 {
     return pipeModel.FillModel;
 }
 protected abstract void SetModelVisibility(CPipeModel pipeModel, bool bVisible);
 protected abstract bool GetModelVisibility(CPipeModel pipeModel);
 protected abstract ISceneNode GetModel(CPipeModel pipeModel);
Esempio n. 12
0
        private void LoadXML(string xmlFile)
        {
            try
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(xmlFile);

                // Read models
                XmlNodeList pipeNodes = xmlDoc.SelectNodes(ModelXMLDefinition.RootNode + /*MSG0*/"//" + ModelXMLDefinition.PipeGroup + /*MSG0*/"//" + ModelXMLDefinition.Pipe);
                foreach (XmlNode pipeNode in pipeNodes)
                {
                    CPipeModel pipeModel = new CPipeModel();
                    pipeModel.ReadFromXMLNode(pipeNode);

                    // Add to data models
                    IApp.theApp.DataModel.PipeModels.Add(pipeModel);
                }

                // Read others
                XmlNodeList otherModels = xmlDoc.SelectNodes(ModelXMLDefinition.RootNode + /*MSG0*/"//" + ModelXMLDefinition.Model);
                foreach (XmlNode otherModel in otherModels)
                {
                    CStaticModel staticModel = new CStaticModel(null);
                    staticModel.ReadFromXMLNode(otherModel);

                    // Add to static models
                    IApp.theApp.DataModel.StaticsModels.Add(staticModel);
                }

                // Read the Modeling UCS to GPS
                XmlNode modelingUCS = xmlDoc.SelectSingleNode(ModelXMLDefinition.RootNode + /*MSG0*/"//" + ModelXMLDefinition.pipeModelingUCS);
                if (modelingUCS != null)
                {
                    CUCS ucs = new CUCS();
                    ucs.ReadFromXMLNode(modelingUCS);

                    IApp.theApp.DataModel.ModelingUCStoGPSUCS = ucs;
                }

                // Read the Modeling Unit to Meter
                XmlNode ModelingUnitToMeterNode = xmlDoc.SelectSingleNode(ModelXMLDefinition.RootNode + /*MSG0*/"//" + ModelXMLDefinition.pipeModelingUnitToMeter);
                if (ModelingUnitToMeterNode != null)
                {
                    double dValue = double.Parse(ModelingUnitToMeterNode.InnerText);

                    IApp.theApp.DataModel.ModelingUnitToMeter = dValue;
                }

                // Read the GPSUnitToMeter
                XmlNode GPSUnitToMeterNode = xmlDoc.SelectSingleNode(ModelXMLDefinition.RootNode + /*MSG0*/"//" + ModelXMLDefinition.pipeGPSUnitToMeter);
                if (GPSUnitToMeterNode != null)
                {
                    double dValue = double.Parse(GPSUnitToMeterNode.InnerText);

                    IApp.theApp.DataModel.GPSUnitToMeter = dValue;
                }

                // Read the pipes boundary
                XmlNodeList boundaryNodes = xmlDoc.SelectNodes(ModelXMLDefinition.RootNode + /*MSG0*/"//" + ModelXMLDefinition.PipesBoundary);
                foreach (XmlNode boundaryNode in boundaryNodes)
                {
                    CBoundaryModel boundaryModel = new CBoundaryModel();
                    boundaryModel.ReadFromXMLNode(boundaryNode);

                    // Add to boundary Models
                    IApp.theApp.DataModel.BoundaryModels.Add(boundaryModel);
                }

            }
            catch (SystemException ex)
            {
                MessageBox.Show(new Form() { TopMost = true }, string.Format(Resources.IDS_ERROR_LOAD_XML, xmlFile), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                string errMsg = ex.Message + "\n" + ex.StackTrace;
                vtk.vtkOutputWindow.GetInstance().DisplayErrorText(errMsg);
                this.Close();
                return;
            }
        }