Exemplo n.º 1
0
 public DrawCylinderLine(IMultiPolyline multiLine, IPipeSection section, string tcName, uint color)
 {
     this._tcName      = "";
     this._color       = 0xffff0000;
     base._modeltype   = ModelType.CylinderLine;
     this._pipeSection = section;
     base._cullModel   = gviCullFaceMode.gviCullNone;
     this._tcName      = tcName;
     this._color       = color;
     if (multiLine != null)
     {
         IEnvelope     envelope = null;
         IPolyline     polyline = null;
         List <Vector> item     = null;
         IPoint        point    = null;
         Vector        vector   = null;
         envelope    = multiLine.Envelope;
         base._x     = (envelope.MaxX + envelope.MinX) / 2.0;
         base._y     = (envelope.MaxY + envelope.MinY) / 2.0;
         base._z     = (envelope.MaxZ + envelope.MinZ) / 2.0;
         this._route = new List <List <Vector> >();
         for (int i = 0; i < multiLine.GeometryCount; i++)
         {
             polyline = multiLine.GetPolyline(i);
             item     = new List <Vector>();
             for (int j = 0; j < polyline.PointCount; j++)
             {
                 point  = polyline.GetPoint(j);
                 vector = new Vector(point.X - base._x, point.Y - base._y, point.Z - base._z);
                 item.Add(vector);
             }
             this._route.Add(item);
         }
     }
 }
Exemplo n.º 2
0
 public static CompareRlt Compare(IPipeSection section1, IPipeSection section2)
 {
     if ((section1.SecShape == section2.SecShape) && (section1.Diameter == section2.Diameter))
     {
         return(CompareRlt.SameSize | CompareRlt.SameShape);
     }
     if ((section1.SecShape == section2.SecShape) && (section1.Diameter != section2.Diameter))
     {
         return(CompareRlt.SameShape);
     }
     return(CompareRlt.SameNot);
 }
Exemplo n.º 3
0
 public void SetParameter(IPipeSection pipeSection, IPolyline polyline, int flowDir)
 {
     try
     {
         this._pipeSection = pipeSection;
         base._cullModel   = gviCullFaceMode.gviCullNone;
         DrawGeometry.GetPolylineVtxs(polyline, ref this._x, ref this._y, ref this._z, ref this._route);
         this._flowDir = flowDir;
         if (this._flowDir == 1)
         {
             List <Vector> list = new List <Vector>();
             for (int i = this._route.Count - 1; i >= 0; i--)
             {
                 list.Add(this._route[i]);
             }
             this._route = list;
         }
     }
     catch (Exception exception)
     {
     }
 }
Exemplo n.º 4
0
        public override bool Draw(out IModelPoint mp, out IModel fmodel, out IModel smodel)
        {
            base.Draw(out mp, out fmodel, out smodel);
            try
            {
                if (base._vtx == null)
                {
                    return(false);
                }
                if ((base._vtx.Length != 1) && (base._vtx.Length != 2))
                {
                    return(false);
                }
                object renderInfo = (base._renderType == RenderType.Texture) ? ((object)base._tcNames) : ((object)base._colors);
                //int[] index = new int[3];
                //index[1] = 1;
                //index[2] = 2;
                int[] index = new int[2];
                index[1] = 1;
                if (!base.NewEmptyModel(index, base._renderType, renderInfo, out fmodel))
                {
                    return(false);
                }
                IDrawGroup group = null;
                group = fmodel.GetGroup(0);
                IDrawPrimitive primitive = group.GetPrimitive(0);
                group.GetPrimitive(1);
                group.GetPrimitive(2);
                if (base._vtx.Length == 1)
                {
                    // 生成类似断头的管线20161111
                    IPipeSection[] dSections = new IPipeSection[] { base._sections[0], DrawGeometry.DefaultSection(base._sections[0].SecShape) };
                    base.DrawConSingle1(base._vtx[0], base._sections[0], ref fmodel);

                    // 原代码
                    //Vector[][] dVtxs = new Vector[][] { base._vtx[0], new Vector[] { base._vtx[0][0], new Vector(base._vtx[0][0].X, base._vtx[0][0].Y, 0.0) } };
                    //IPipeSection[] dSections = new IPipeSection[] { base._sections[0], DrawGeometry.DefaultSection(base._sections[0].SecShape) };
                    //base.DrawConBetween(dVtxs, dSections, ref fmodel);
                }
                else
                {
                    base.DrawConBetween(new Vector[][] { base._vtx[0], base._vtx[1] }, new IPipeSection[] { base._sections[0], base._sections[1] }, ref fmodel);
                    Vector[] dVtx = new Vector[] { base._vtx[0][0], new Vector(base._vtx[0][0].X, base._vtx[0][0].Y, 0.0) };
                    base.DrawConSingle(dVtx, DrawGeometry.DefaultSection(base._sections[0].SecShape), ref fmodel);
                }
                IDrawGroup drawGroup = null;
                if (this._bfModel.GroupCount > 0)
                {
                    for (int i = 0; i < this._bfModel.GroupCount; i++)
                    {
                        drawGroup = this._bfModel.GetGroup(i);
                        fmodel.AddGroup(drawGroup);
                    }
                }
                if (this._bsModel != null)
                {
                    int[] numArray2 = new int[1];
                    base.NewEmptyModel(numArray2, base._renderType, renderInfo, out smodel);
                    IDrawPrimitive primitive2 = smodel.GetGroup(0).GetPrimitive(0);
                    primitive2.Material.CullMode = gviCullFaceMode.gviCullNone;
                    primitive2.VertexArray       = primitive.VertexArray;
                    primitive2.NormalArray       = primitive.NormalArray;
                    primitive2.TexcoordArray     = primitive.TexcoordArray;
                    primitive2.IndexArray        = primitive.IndexArray;
                    if (this._bsModel.GroupCount > 0)
                    {
                        for (int j = 0; j < this._bsModel.GroupCount; j++)
                        {
                            drawGroup = this._bsModel.GetGroup(j);
                            smodel.AddGroup(drawGroup);
                        }
                    }
                }
                return(true);
            }
            catch (Exception exception)
            {
                return(false);
            }
        }
Exemplo n.º 5
0
        public bool ShowFlowDirection(int flowDir, out IRenderModelPoint rpt)
        {
            rpt = null;
            if (base._rowInfo == null)
            {
                return(false);
            }

            string str = Application.StartupPath + @"\..\Resource\Images\FlowDirection";

            if (!Directory.Exists(str))
            {
                return(false);
            }
            IImage _imgFlowImg = DrawGeometry.resFactory.CreateImageFromFile(str);

            _imgFlowImg.FrameInterval = 50;

            IPolyline        path        = null;
            IPipeSection     pipeSection = null;
            string           name        = "FlowDirection";
            IDrawDynamicFlow flow        = null;
            IModelPoint      mp          = null;

            try
            {
                IModel    model;
                IModel    model2;
                IPoint    pointValue = null;
                IPolyline polyline2  = null;
                polyline2 = base._geoGroup[1] as IPolyline;
                if ((polyline2 == null) || (polyline2.PointCount < 2))
                {
                    return(false);
                }
                path = polyline2.Clone() as IPolyline;
                for (int i = 0; i < path.PointCount; i++)
                {
                    pointValue = path.GetPoint(i);
                    if (pointValue != null)
                    {
                        pointValue.Z += this.OffsetZ;
                        path.UpdatePoint(i, pointValue);
                    }
                }

                pipeSection = new PipeSection(this._dia1, this._dia2, HorizontalPos.Center, VerticalPos.Center, 0.02, 0);

                flow = ParamModelFactory.Instance.CreateGeometryDraw(ModelType.DynamicFlow, Guid.NewGuid().ToString()) as IDrawDynamicFlow;
                flow.SetParameter(pipeSection, path, flowDir);
                flow.SetTextureRender(new string[] { name });
                if (!flow.Draw(out mp, out model, out model2))
                {
                    return(false);
                }

                #region 需要runtime授权
                IFeatureDataSet  iFeatureDataSet = DF3DPipeCreateApp.App.TempLib.OpenFeatureDataset("FeatureDataSet");
                IResourceManager manager         = iFeatureDataSet as IResourceManager;
                if (!manager.ModelExist(mp.ModelName))
                {
                    manager.AddModel(mp.ModelName, model, null);
                }
                if (!manager.ImageExist(name))
                {
                    manager.AddImage(name, _imgFlowImg);
                }
                #endregion

                IModelPointSymbol symbol = new ModelPointSymbolClass();
                symbol.SetResourceDataSet(iFeatureDataSet);
                symbol.Color       = uint.MaxValue;
                symbol.EnableColor = true;
                mp.ModelEnvelope   = model.Envelope;
                rpt = DrawGeometry.Ocx.ObjectManager.CreateRenderModelPoint(mp, symbol, DrawGeometry.Ocx.ProjectTree.RootID);

                return(true);
            }
            catch (Exception exception)
            {
                return(false);
            }
        }
Exemplo n.º 6
0
        public bool GetPipeLineParameter(double thick, out List <Vector> vtxs, out IPipeSection section)
        {
            vtxs    = null;
            section = null;
            IPolyline polyline = null;

            if ((base._geoGroup[1] == null) || ((polyline = base._geoGroup[1] as IPolyline) == null))
            {
                return(false);
            }
            if (polyline.PointCount < 2)
            {
                return(false);
            }
            IPoint p       = null;
            Vector vector  = null;
            Vector vector2 = null;
            Vector item    = null;

            vtxs    = new List <Vector>();
            section = new PipeSection(this._dia1, this._dia2, HorizontalPos.Center, VerticalPos.Center, thick, 0);
            for (int i = 0; i < polyline.PointCount; i++)
            {
                p = polyline.GetPoint(i);
                if (p != null)
                {
                    vector = new Vector(p);
                    if ((this._dia1 > 1.5) || (this._dia2 > 1.5))
                    {
                        item = vector;
                    }
                    else if (i == 0)
                    {
                        // 增加起点退让判断,并对较短管线做处理 FX 2014.04.08
                        vector2 = new Vector(polyline.GetSegment(i));
                        double length = vector2.Length;
                        vector2 = vector2.UnitVector();
                        if (this._isSBackhind)
                        {
                            if (length > (section.Diameter / 1.8))
                            {
                                item = vector + ((Vector)((vector2 * section.Diameter) / 1.8));
                            }
                            else
                            {
                                item = vector + ((Vector)((vector2 * length) / 1.8));
                            }
                        }
                        else
                        {
                            item = vector;
                        }
                    }
                    else if (i == (polyline.PointCount - 1))
                    {
                        // 增加终点退让判断,并对较短管线做处理 FX 2014.04.08
                        vector2 = new Vector(polyline.GetSegment(i - 1));
                        double length = vector2.Length;
                        vector2 = -vector2.UnitVector();
                        if (this._isEBackhind)
                        {
                            if (length > (section.Diameter / 1.8))
                            {
                                item = vector + ((Vector)((vector2 * section.Diameter) / 1.8));
                            }
                            else
                            {
                                item = vector + ((Vector)((vector2 * length) / 1.8));
                            }
                        }
                        else
                        {
                            item = vector;
                        }
                    }
                    else
                    {
                        item = vector;
                    }
                    item.Z += this.OffsetZ;
                    vtxs.Add(item);
                }
            }
            return(true);
        }
Exemplo n.º 7
0
        // 架空
        public bool GetPipeNodeParameterOver(int flag, out Vector[] vtxs, out Vector dir, out IPipeSection section, out int FLAG)
        {
            FLAG    = -1;
            vtxs    = null;
            dir     = null;
            section = null;
            IPolyline polyline = null;

            if ((base._geoGroup[1] == null) || ((polyline = base._geoGroup[1] as IPolyline) == null))
            {
                return(false);
            }
            if (polyline.PointCount < 2)
            {
                return(false);
            }
            ISegment seg     = null;
            Vector   vector  = null;
            Vector   vector2 = null;

            vtxs    = new Vector[2];
            section = new PipeSection(this._dia1, this._dia2, HorizontalPos.Center, this._vPos, 0.02, 0);
            if (flag == 0)
            {
                vector  = new Vector(polyline.GetPoint(0));
                vtxs[0] = vector;
                seg     = polyline.GetSegment(0);
                if (Math.Abs(seg.EndPoint.Z - seg.StartPoint.Z) > 0.4)
                {
                    FLAG = 1;
                }
                dir     = new Vector(seg);
                dir     = dir.UnitVector();
                vector2 = vector + ((Vector)((dir * section.Diameter) / 2.0));
                vtxs[1] = vector2;
            }
            else
            {
                vector  = new Vector(polyline.GetPoint(polyline.PointCount - 1));
                vtxs[0] = vector;
                seg     = polyline.GetSegment(polyline.PointCount - 2);
                if (Math.Abs(seg.EndPoint.Z - seg.StartPoint.Z) > 0.4)
                {
                    FLAG = 1;
                }
                dir     = new Vector(seg);
                dir     = (-dir).UnitVector();
                vector2 = vector + ((Vector)((dir * section.Diameter) / 2.0));
                vtxs[1] = vector2;
            }
            return(true);
        }
Exemplo n.º 8
0
        // 地下—针对管线较短情况
        public bool GetPipeNodeParameterUnder(int flag, out Vector[] vtxs, out Vector dir, out IPipeSection section)
        {
            vtxs    = null;
            dir     = null;
            section = null;
            IPolyline polyline = null;

            if ((base._geoGroup[1] == null) || ((polyline = base._geoGroup[1] as IPolyline) == null))
            {
                return(false);
            }
            if (polyline.PointCount < 2)
            {
                return(false);
            }
            ISegment seg     = null;
            Vector   vector  = null;
            Vector   vector2 = null;

            vtxs    = new Vector[2];
            section = new PipeSection(this._dia1, this._dia2, HorizontalPos.Center, VerticalPos.Center, 0.02, 0);
            if (flag == 0)
            {
                vector  = new Vector(polyline.GetPoint(0));
                vtxs[0] = new Vector(vector.X, vector.Y, vector.Z + this.OffsetZ);
                seg     = polyline.GetSegment(0);
                dir     = new Vector(seg);
                dir     = dir.UnitVector();
                double length = dir.Length;
                // 针对管线较短情况
                if (length > (section.Diameter / 2))
                {
                    vector2 = vector + ((Vector)((dir * section.Diameter) / 2.0));
                }
                else
                {
                    vector2 = vector + ((Vector)((dir * length) / 2.0));
                }
                vtxs[1] = new Vector(vector2.X, vector2.Y, vector2.Z + this.OffsetZ);
            }
            else
            {
                vector  = new Vector(polyline.GetPoint(polyline.PointCount - 1));
                vtxs[0] = new Vector(vector.X, vector.Y, vector.Z + this.OffsetZ);
                seg     = polyline.GetSegment(polyline.PointCount - 2);
                dir     = new Vector(seg);
                double length = dir.Length;
                dir = -dir.UnitVector();
                // 针对管线较短情况
                if (length > (section.Diameter / 2))
                {
                    vector2 = vector + ((Vector)((dir * section.Diameter) / 2.0));
                }
                else
                {
                    vector2 = vector + ((Vector)((dir * length) / 2.0));
                }
                vtxs[1] = new Vector(vector2.X, vector2.Y, vector2.Z + this.OffsetZ);
            }
            return(true);
        }