Beispiel #1
0
        private void startX_TextChanged(object sender, EventArgs e)
        {
            if (polyline == null || renderPolyline == null)
            {
                return;
            }
            else
            {
                if (flagx == false)
                {
                    IPoint fde_point = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPoint,
                                                                 gviVertexAttribute.gviVertexAttributeZ) as IPoint;
                    fde_point.SetCoords(double.Parse(this.startX.Text), double.Parse(this.startY.Text), double.Parse(this.startZ.Text), 0, 0);
                    polyline.UpdatePoint(0, fde_point);

                    fde_point = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPoint,
                                                          gviVertexAttribute.gviVertexAttributeZ) as IPoint;
                    fde_point.SetCoords(double.Parse(this.endX.Text), double.Parse(this.endY.Text), double.Parse(this.endZ.Text), 0, 0);
                    polyline.UpdatePoint(1, fde_point);
                    renderPolyline.SetFdeGeometry(polyline);
                }
            }
        }
Beispiel #2
0
        private void _3DControl_RcMouseClickSelect(object sender, Gvitech.CityMaker.Controls._IRenderControlEvents_RcMouseClickSelectEvent e)
        {
            try
            {
                if (e.intersectPoint != null)
                {
                    IPoint pt1 = this._geoFactory.CreateGeometry(gviGeometryType.gviGeometryPoint, gviVertexAttribute.gviVertexAttributeZ) as IPoint;
                    pt1.X = e.intersectPoint.X;
                    pt1.Y = e.intersectPoint.Y;
                    pt1.Z = e.intersectPoint.Z;
                    if (e.eventSender == gviMouseSelectMode.gviMouseSelectClick)
                    {
                        if (!this._isStarted)
                        {
                            this.Close();
                            if (this._onStartDraw != null)
                            {
                                this._onStartDraw();
                            }
                            if (_polyline != null)
                            {
                                _polyline = null;
                            }
                            startPoint = pt1;
                            double radius = 0.0000001;
                            this._geo             = (startPoint as ITopologicalOperator2D).Buffer2D(radius, gviBufferStyle.gviBufferCapround);
                            _rPolygon             = this._3DControl.ObjectManager.CreateRenderPolygon(this._geo as IPolygon, this._surfaceSymbol, this._rootID);
                            _rPolygon.HeightStyle = this._heightStyle;

                            this._3DControl.HighlightHelper.SetRegion(this._geo);
                            this._3DControl.HighlightHelper.VisibleMask = 1;

                            _polyline = this._geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolyline, gviVertexAttribute.gviVertexAttributeZ) as IPolyline;
                            _polyline.AppendPoint(pt1);
                            IPoint pt2 = pt1.Clone() as IPoint;
                            pt2.X += 0.000001;
                            _polyline.AppendPoint(pt2);
                            _rPolyline      = this._3DControl.ObjectManager.CreateRenderPolyline(_polyline, this._curveSymbol, this._3DControl.ProjectTree.RootID);
                            _label          = this._3DControl.ObjectManager.CreateLabel(this._3DControl.ProjectTree.RootID);
                            _label.Position = _polyline.Midpoint;
                            _label.Text     = _polyline.Length.ToString("0.00") + " 米";
                            ITextSymbol   ts = new TextSymbolClass();
                            TextAttribute ta = new TextAttribute();
                            ta.TextColor      = Convert.ToUInt32(SystemInfo.Instance.TextColor, 16);
                            ta.TextSize       = SystemInfo.Instance.TextSize;
                            ts.TextAttribute  = ta;
                            _label.TextSymbol = ts;
                            this._isStarted   = true;
                            this._isFinished  = false;
                        }
                        else
                        {
                            //this.End();
                            this._isStarted  = false;
                            this._isFinished = true;

                            _polyline.UpdatePoint(1, pt1);
                            _rPolyline.SetFdeGeometry(_polyline);

                            _label.Position = _polyline.Midpoint;
                            _label.Text     = _polyline.Length.ToString("0.00") + " 米";


                            double radius = Math.Sqrt((startPoint.X - pt1.X) * (startPoint.X - pt1.X)
                                                      + (startPoint.Y - pt1.Y) * (startPoint.Y - pt1.Y) + (startPoint.Z - pt1.Z) * (startPoint.Z - pt1.Z));
                            this._geo = (startPoint as ITopologicalOperator2D).Buffer2D(radius, gviBufferStyle.gviBufferCapround);
                            _rPolygon.SetFdeGeometry(this._geo);
                            this._3DControl.HighlightHelper.SetRegion(this._geo);
                            this._geo = this._geo.Clone2(gviVertexAttribute.gviVertexAttributeNone);
                            if (this._onFinishedDraw != null)
                            {
                                this._onFinishedDraw();
                            }
                        }
                    }
                    else if (e.eventSender == gviMouseSelectMode.gviMouseSelectMove)
                    {
                        if (_rPoint != null)
                        {
                            this._objectManager.DeleteObject(_rPoint.Guid);
                            System.Runtime.InteropServices.Marshal.ReleaseComObject(_rPoint);
                            _rPoint = null;
                        }
                        _rPoint = this._objectManager.CreateRenderPoint(pt1, this._simplePointSymbol, this._rootID);
                        if (this._isStarted)
                        {
                            _polyline.UpdatePoint(1, pt1);
                            _rPolyline.SetFdeGeometry(_polyline);

                            _label.Position = _polyline.Midpoint;
                            _label.Text     = _polyline.Length.ToString("0.00") + " 米";

                            double radius = Math.Sqrt((startPoint.X - pt1.X) * (startPoint.X - pt1.X)
                                                      + (startPoint.Y - pt1.Y) * (startPoint.Y - pt1.Y) + (startPoint.Z - pt1.Z) * (startPoint.Z - pt1.Z));
                            this._geo = (startPoint as ITopologicalOperator2D).Buffer2D(radius, gviBufferStyle.gviBufferCapround);
                            _rPolygon.SetFdeGeometry(this._geo);
                            this._3DControl.HighlightHelper.SetRegion(this._geo);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace);
            }
        }
Beispiel #3
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);
            }
        }