Exemple #1
0
        void t_Tick(object sender, EventArgs e)
        {
            Random r = new Random();
            int    i = 0;

            foreach (IRenderModelPoint rmp in list)
            {
                //System.Threading.Thread.Sleep(2);
                int n = r.Next(100);
                if (n > 80)
                {
                    rmp.Highlight(System.Drawing.Color.Red);
                }
                else if (n > 40 && n <= 80)
                {
                    rmp.Highlight(System.Drawing.Color.Yellow);
                }
                else
                {
                    rmp.Highlight(System.Drawing.Color.Blue);
                }
                IModelPoint modelPoint = rmp.GetFdeGeometry() as IModelPoint;
                modelPoint.FromMatrix(MatrixList[i]);
                i++;
                ITransform tf = modelPoint as ITransform;
                tf.Scale3D(1, 1, n, modelPoint.Envelope.Center.X, modelPoint.Envelope.Center.Y, modelPoint.Envelope.MinZ);
                IModelPoint newModelPoint = tf as IModelPoint;
                rmp.SetFdeGeometry(newModelPoint);
            }
        }
Exemple #2
0
        private void Scalling(double X, double Y, double Z)
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            this.bFinished          = false;
            this.modifyRowbufferMap = SelectCollection.Instance().Clone(this.beginRowbufferMap);
            if (this.modifyRowbufferMap != null)
            {
                foreach (DF3DFeatureClass featureClassInfo in this.modifyRowbufferMap.Keys)
                {
                    IFeatureClass featureClass = featureClassInfo.GetFeatureClass();
                    if (featureClass == null)
                    {
                        continue;
                    }
                    string facName = featureClassInfo.GetFacilityClassName();

                    IRowBufferCollection rowBufferCollection = this.modifyRowbufferMap[featureClassInfo] as IRowBufferCollection;
                    for (int i = 0; i < rowBufferCollection.Count; i++)
                    {
                        IRowBuffer rowBuffer = rowBufferCollection.Get(i);
                        if (rowBuffer != null)
                        {
                            int num = rowBuffer.FieldIndex(featureClassInfo.GetFeatureLayer().GeometryFieldName);
                            if (num != -1)
                            {
                                IGeometry geometry = rowBuffer.GetValue(num) as IGeometry;
                                if (geometry != null)
                                {
                                    ITransform transform = geometry as ITransform;
                                    if (geometry.HasZ())
                                    {
                                        transform.Scale3D(X, Y, Z, this.centerX, this.centerY, this.centerZ);
                                    }
                                    else
                                    {
                                        transform.Scale2D(X, Y, this.centerX, this.centerY);
                                    }
                                    rowBuffer.SetValue(num, transform);
                                }
                            }
                            #region 管线设施
                            if (facName == "PipeLine" || facName == "PipeNode" || facName == "PipeBuild" || facName == "PipeBuild1")
                            {
                                int num3 = rowBuffer.FieldIndex("Shape");
                                if (num3 != -1)
                                {
                                    IGeometry geometry = rowBuffer.GetValue(num3) as IGeometry;
                                    if (geometry != null)
                                    {
                                        ITransform transform = geometry as ITransform;
                                        if (geometry != null && transform != null)
                                        {
                                            if (geometry.HasZ())
                                            {
                                                transform.Scale3D(X, Y, Z, this.centerX, this.centerY, this.centerZ);
                                            }
                                            else
                                            {
                                                transform.Scale2D(X, Y, this.centerX, this.centerY);
                                            }
                                            rowBuffer.SetValue(num3, transform);
                                        }
                                    }
                                }
                                int num4 = rowBuffer.FieldIndex("FootPrint");
                                if (num4 != -1)
                                {
                                    IGeometry geometry = rowBuffer.GetValue(num4) as IGeometry;
                                    if (geometry != null)
                                    {
                                        ITransform transform = geometry as ITransform;
                                        if (geometry != null && transform != null)
                                        {
                                            if (geometry.HasZ())
                                            {
                                                transform.Scale3D(X, Y, Z, this.centerX, this.centerY, this.centerZ);
                                            }
                                            else
                                            {
                                                transform.Scale2D(X, Y, this.centerX, this.centerY);
                                            }
                                            rowBuffer.SetValue(num4, transform);
                                        }
                                    }
                                }
                            }
                            #endregion
                        }
                    }
                    app.Current3DMapControl.FeatureManager.EditFeatures(featureClass, rowBufferCollection);
                    //System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass);
                }
            }
        }
        private void ScaleSelection()
        {
            DF3DApplication app = DF3DApplication.Application;

            if (app == null || app.Current3DMapControl == null)
            {
                return;
            }
            double num  = double.Parse(this.spinEditX.EditValue.ToString());
            double num2 = double.Parse(this.spinEditY.EditValue.ToString());
            double num3 = double.Parse(this.spinEditZ.EditValue.ToString());

            if (num == 0.0 && num2 == 0.0 && num3 == 0.0)
            {
                return;
            }
            System.Collections.Generic.Dictionary <DF3DFeatureClass, IRowBufferCollection> rowBuffers = this.GetRowBuffers();
            if (rowBuffers.Count < 1)
            {
                return;
            }
            IEnvelope selectEnvelope = SelectCollection.Instance().GetSelectEnvelope(SelectCollection.Instance().FcRowBuffersMap);
            double    centerX        = 0.0;
            double    centerY        = 0.0;
            double    centerZ        = 0.0;

            if (selectEnvelope != null && selectEnvelope.Valid())
            {
                centerX = (selectEnvelope.MinX + selectEnvelope.MaxX) / 2.0;
                centerY = (selectEnvelope.MinY + selectEnvelope.MaxY) / 2.0;
                centerZ = (selectEnvelope.MinZ + selectEnvelope.MaxZ) / 2.0;
            }
            foreach (DF3DFeatureClass current in rowBuffers.Keys)
            {
                Gvitech.CityMaker.FdeCore.IFeatureClass featureClass = current.GetFeatureClass();
                IFeatureLayer        featureLayer        = current.GetFeatureLayer();
                IRowBufferCollection rowBufferCollection = rowBuffers[current];
                for (int i = 0; i < rowBufferCollection.Count; i++)
                {
                    Gvitech.CityMaker.FdeCore.IRowBuffer rowBuffer = rowBufferCollection.Get(i);
                    int        position  = rowBuffer.FieldIndex(featureLayer.GeometryFieldName);
                    IGeometry  geometry  = rowBuffer.GetValue(position) as IGeometry;
                    ITransform transform = geometry as ITransform;
                    if (geometry != null && transform != null)
                    {
                        if (this._editType == RenderEditorType.ScaleCenterType)
                        {
                            IEnvelope envelope = geometry.Envelope;
                            centerX = (envelope.MinX + envelope.MaxX) / 2.0;
                            centerY = (envelope.MinY + envelope.MaxY) / 2.0;
                            centerZ = (envelope.MinZ + envelope.MaxZ) / 2.0;
                        }
                        if (geometry.HasZ())
                        {
                            transform.Scale3D(num, num2, num3, centerX, centerY, centerZ);
                        }
                        else
                        {
                            transform.Scale2D(num, num2, centerX, centerY);
                        }
                        rowBuffer.SetValue(position, transform);
                    }
                }
                app.Current3DMapControl.FeatureManager.EditFeatures(featureClass, rowBufferCollection);
                //System.Runtime.InteropServices.Marshal.ReleaseComObject(featureClass);
            }
            RenderControlEditServices.Instance().SetEditorPosition(SelectCollection.Instance().FcRowBuffersMap);
            this.UpdateDatabase(rowBuffers);
        }