Esempio n. 1
0
        private void dt_ColumnChanged(object sender, DataColumnChangeEventArgs e)
        {
            if (this.m_CanDo)
            {
                int           rowNumber    = this.dataGrid1.CurrentCell.RowNumber;
                int           columnNumber = this.dataGrid1.CurrentCell.ColumnNumber;
                object        obj2         = this.dataGrid1[rowNumber, columnNumber];
                LayerSnapInfo info         = (LayerSnapInfo)this.m_pArray.get_Element(rowNumber);
                switch (columnNumber)
                {
                case 1:
                    info.bSnapVertex = (bool)obj2;
                    break;

                case 2:
                    info.bSnapBoundary = (bool)obj2;
                    break;

                case 3:
                    info.bSnapEndPoint = (bool)obj2;
                    break;

                case 4:
                    info.bVerticalSnap = (bool)obj2;
                    break;
                }
            }
        }
Esempio n. 2
0
 private void ReadGroupLayer(IGroupLayer pGroupLayer)
 {
     for (int i = 0; i < (pGroupLayer as ICompositeLayer).Count; i++)
     {
         ILayer layer = (pGroupLayer as ICompositeLayer).get_Layer(i);
         if (layer is IGroupLayer)
         {
             this.ReadGroupLayer(layer as IGroupLayer);
         }
         else if (layer is IFeatureLayer)
         {
             IFeatureLayer layer2 = layer as IFeatureLayer;
             LayerSnapInfo lSInfo = new LayerSnapInfo
             {
                 Layer = layer2
             };
             this.GetSnapInfo(ref lSInfo);
             this.m_pArray.Add(lSInfo);
             object[] values = new object[]
             {
                 layer2.Name, lSInfo.bSnapVertex, lSInfo.bSnapBoundary, lSInfo.bSnapEndPoint,
                 lSInfo.bVerticalSnap
             };
             this.dt.Rows.Add(values);
         }
     }
 }
Esempio n. 3
0
 private void AddNewLayer()
 {
     for (int i = 0; i < this.m_pMap.LayerCount; i++)
     {
         ILayer layer = this.m_pMap.get_Layer(i);
         if (layer is IGroupLayer)
         {
             this.AddFromGroupLayer(layer as IGroupLayer);
         }
         else if ((layer is IFeatureLayer) && !this.LayerIsInSnapConfig(layer as IFeatureLayer))
         {
             LayerSnapInfo lSInfo = new LayerSnapInfo
             {
                 Layer = layer as IFeatureLayer
             };
             this.GetSnapInfo(ref lSInfo);
             this.m_pArray.Add(lSInfo);
             object[] values = new object[]
             {
                 layer.Name, lSInfo.bSnapVertex, lSInfo.bSnapBoundary, lSInfo.bSnapEndPoint,
                 lSInfo.bVerticalSnap
             };
             this.dt.Rows.Add(values);
         }
     }
 }
Esempio n. 4
0
 private bool LayerIsInSnapConfig(IFeatureLayer pFindLayer)
 {
     for (int i = 0; i < this.m_pArray.Count; i++)
     {
         LayerSnapInfo info = this.m_pArray.get_Element(i) as LayerSnapInfo;
         if (pFindLayer == info.Layer)
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 5
0
 private void DeleteLayer(IFeatureLayer pFeatureLayer)
 {
     for (int i = 0; i < this.m_pArray.Count; i++)
     {
         LayerSnapInfo info = this.m_pArray.get_Element(i) as LayerSnapInfo;
         if (pFeatureLayer == info.Layer)
         {
             this.m_pArray.Remove(i);
             this.dt.Rows.RemoveAt(i);
         }
     }
 }
Esempio n. 6
0
 private void SnapConfigControl_ItemDeleted(object Item)
 {
     if (Item is IFeatureLayer)
     {
         for (int i = 0; i < this.m_pArray.Count; i++)
         {
             LayerSnapInfo info = this.m_pArray.get_Element(i) as LayerSnapInfo;
             if (Item == info.Layer)
             {
                 this.m_pArray.Remove(i);
                 this.dt.Rows.RemoveAt(i);
             }
         }
     }
 }
Esempio n. 7
0
 private void SnapConfigControl_OnMapDocumentChangedEvent()
 {
     if (this.m_pMap.LayerCount == 0)
     {
         this.m_pArray.RemoveAll();
         this.dt.Rows.Clear();
     }
     else
     {
         for (int i = 0; i < this.m_pArray.Count; i++)
         {
             LayerSnapInfo info = this.m_pArray.get_Element(i) as LayerSnapInfo;
             if (!this.LayerIsExit(this.m_pMap, info.Layer))
             {
                 this.m_pArray.Remove(i);
                 this.dt.Rows.RemoveAt(i);
             }
         }
         this.AddNewLayer();
     }
 }
Esempio n. 8
0
 private void InitContrl()
 {
     this.m_pArray.RemoveAll();
     this.dt.Rows.Clear();
     for (int i = 0; i < this.m_pMap.LayerCount; i++)
     {
         ILayer layer2 = this.m_pMap.get_Layer(i);
         if (layer2 is IGroupLayer)
         {
             this.ReadGroupLayer(layer2 as IGroupLayer);
         }
         else if (layer2 is IFeatureLayer)
         {
             IFeatureLayer layer  = layer2 as IFeatureLayer;
             LayerSnapInfo lSInfo = new LayerSnapInfo
             {
                 Layer = layer
             };
             this.GetSnapInfo(ref lSInfo);
             this.m_pArray.Add(lSInfo);
             object[] values = new object[]
             {
                 layer.Name, lSInfo.bSnapVertex, lSInfo.bSnapBoundary, lSInfo.bSnapEndPoint,
                 lSInfo.bVerticalSnap
             };
             this.dt.Rows.Add(values);
         }
     }
     if (this.m_pSnapEnvironment != null)
     {
         this.txtRadio.Text = this.m_pSnapEnvironment.SnapTolerance.ToString();
         this.cboSnapUnits.SelectedIndex = (int)this.m_pSnapEnvironment.SnapToleranceUnits;
         this.chkStartSnap.Checked       = ApplicationRef.Application.UseSnap;
     }
     else
     {
         this.txtRadio.Text = this.m_pEngineSnapEnvironment.SnapTolerance.ToString();
         this.cboSnapUnits.SelectedIndex = (int)this.m_pEngineSnapEnvironment.SnapToleranceUnits;
     }
 }
Esempio n. 9
0
 private void SnapConfigControl_ItemAdded(object Item)
 {
     if (Item is IFeatureLayer)
     {
         IFeatureLayer pFindLayer = Item as IFeatureLayer;
         if (!this.LayerIsInSnapConfig(pFindLayer))
         {
             LayerSnapInfo lSInfo = new LayerSnapInfo
             {
                 Layer = pFindLayer
             };
             this.GetSnapInfo(ref lSInfo);
             this.m_pArray.Add(lSInfo);
             object[] values = new object[]
             {
                 pFindLayer.Name, lSInfo.bSnapVertex, lSInfo.bSnapBoundary, lSInfo.bSnapEndPoint,
                 lSInfo.bVerticalSnap
             };
             this.dt.Rows.Add(values);
         }
     }
 }
Esempio n. 10
0
        private void GetSnapInfo(ref LayerSnapInfo LSInfo)
        {
            int           num;
            int           geometryHitType;
            IFeatureClass featureClass = LSInfo.Layer.FeatureClass;

            if (this.m_pSnapEnvironment != null)
            {
                IFeatureSnapAgent agent = null;
                for (num = 0; num < this.m_pSnapEnvironment.SnapAgentCount; num++)
                {
                    agent = this.m_pSnapEnvironment.get_SnapAgent(num) as IFeatureSnapAgent;
                    if ((agent != null) && (featureClass == agent.FeatureClass))
                    {
                        if (agent is IVerticalSnapAgent)
                        {
                            LSInfo.bVerticalSnap = true;
                        }
                        else
                        {
                            geometryHitType = agent.GeometryHitType;
                            if ((geometryHitType & 4) != 0)
                            {
                                LSInfo.bSnapBoundary = true;
                            }
                            if ((geometryHitType & 32) != 0)
                            {
                            }
                            if ((geometryHitType & 16) != 0)
                            {
                                LSInfo.bSnapEndPoint = true;
                            }
                            if ((geometryHitType & 8) != 0)
                            {
                            }
                            if ((geometryHitType & 1) != 0)
                            {
                                LSInfo.bSnapVertex = true;
                            }
                        }
                    }
                }
            }
            else
            {
                IEngineFeatureSnapAgent agent2 = null;
                for (num = 0; num < this.m_pEngineSnapEnvironment.SnapAgentCount; num++)
                {
                    agent2 = this.m_pEngineSnapEnvironment.get_SnapAgent(num) as IEngineFeatureSnapAgent;
                    if ((agent2 != null) && (featureClass == agent2.FeatureClass))
                    {
                        if (agent2 is IVerticalSnapAgent)
                        {
                            LSInfo.bVerticalSnap = true;
                        }
                        else
                        {
                            geometryHitType = (int)agent2.HitType;
                            if ((geometryHitType & 4) != 0)
                            {
                                LSInfo.bSnapBoundary = true;
                            }
                            if ((geometryHitType & 32) != 0)
                            {
                            }
                            if ((geometryHitType & 16) != 0)
                            {
                                LSInfo.bSnapEndPoint = true;
                            }
                            if ((geometryHitType & 8) != 0)
                            {
                            }
                            if ((geometryHitType & 1) != 0)
                            {
                                LSInfo.bSnapVertex = true;
                            }
                        }
                    }
                }
            }
        }