Exemplo n.º 1
0
 private void Operate(IGeometry geometry)
 {
     IFeatureClass currentFeatureClass = null;
     switch (this.dataType)
     {
         case DataType.Flow:
             currentFeatureClass = FlowFeatureClass;
             break;
         case DataType.Parking:
             currentFeatureClass = ParkingFeatureClass;
             break;
     }
     switch (this.operateMode)
     {
         case OperateMode.Add:
             OperateForm operateform = new OperateForm(currentFeatureClass,geometry);
             operateform.ShowDialog(this);
             break;
         case OperateMode.Delete:
              IArray array = AttributeHelper.Identify(currentFeatureClass, geometry,"");
              if (array != null)
              {
                  IFeatureIdentifyObj featureIdentifyObj = array.get_Element(0) as IFeatureIdentifyObj;
                  IIdentifyObj identifyObj = featureIdentifyObj as IIdentifyObj;
                  IRowIdentifyObject rowidentifyObject = featureIdentifyObj as IRowIdentifyObject;
                  IFeature feature = rowidentifyObject.Row as IFeature;
                  if (feature != null)
                  {
                      Twinkle(feature);
                      if (MessageBox.Show("您确定要删除当前选择交通流量检查器", "警告",MessageBoxButtons.OKCancel) == DialogResult.OK)
                      {
                          feature.Delete();
                          MapRefresh();
                      }
                  }
              }
             break;
         case OperateMode.Edit:
              IArray arrayEdit = AttributeHelper.Identify(currentFeatureClass, geometry,"");
              if (arrayEdit != null)
              {
                  IFeatureIdentifyObj featureIdentifyObj = arrayEdit.get_Element(0) as IFeatureIdentifyObj;
                  IIdentifyObj identifyObj = featureIdentifyObj as IIdentifyObj;
                  IRowIdentifyObject rowidentifyObject = featureIdentifyObj as IRowIdentifyObject;
                  IFeature feature = rowidentifyObject.Row as IFeature;
                  if (feature != null)
                  {
                      Twinkle(feature);
                      var form = new OperateForm(currentFeatureClass, feature);
                      form.ShowDialog(this);
                  }
              }
             break;
     }
 }
Exemplo n.º 2
0
        private void Operate(IGeometry geometry)
        {
            IFeatureClass currentFeatureClass = null;
            string whereClause = string.Empty;
            string Warning = string.Empty;
            switch (this.dataType)
            {
                case DataType.Flow:
                    currentFeatureClass = FlowFeatureClass;
                    whereClause = FlowWhereClause;
                    Warning = FlowName.GetLayer();
                    break;
                case DataType.Parking:
                    currentFeatureClass = ParkingFeatureClass;
                    whereClause = ParkingWhereClause;
                    Warning = ParkingName.GetLayer();
                    break;
                case DataType.Road:
                    currentFeatureClass = RoadFeatureClass;
                    whereClause = RoadFilterWhereClause;
                    Warning = RoadName.GetLayer();
                    break;
            }

            switch (this.operateMode)
            {
                case OperateMode.Add:
                    OperateForm operateform = new OperateForm(currentFeatureClass,geometry);
                    operateform.ShowDialog(this);
                    break;
                case OperateMode.Delete:
                     IArray array = AttributeHelper.Identify(currentFeatureClass, geometry,whereClause);
                     if (array != null)
                     {
                         IFeatureIdentifyObj featureIdentifyObj = array.get_Element(0) as IFeatureIdentifyObj;
                         IIdentifyObj identifyObj = featureIdentifyObj as IIdentifyObj;
                         IRowIdentifyObject rowidentifyObject = featureIdentifyObj as IRowIdentifyObject;
                         IFeature feature = rowidentifyObject.Row as IFeature;
                         if (feature != null)
                         {
                             Twinkle(feature);
                             if (MessageBox.Show("您确定要删除当前选择"+Warning, "警告",MessageBoxButtons.OKCancel) == DialogResult.OK)
                             {
                                 feature.Delete();
                                 MapRefresh();
                             }
                         }
                     }
                    break;
                case OperateMode.Edit:
                     IArray arrayEdit = AttributeHelper.Identify(currentFeatureClass, geometry,whereClause);
                     if (arrayEdit != null)
                     {
                         IFeatureIdentifyObj featureIdentifyObj = arrayEdit.get_Element(0) as IFeatureIdentifyObj;
                         IIdentifyObj identifyObj = featureIdentifyObj as IIdentifyObj;
                         IRowIdentifyObject rowidentifyObject = featureIdentifyObj as IRowIdentifyObject;
                         IFeature feature = rowidentifyObject.Row as IFeature;
                         if (feature != null)
                         {
                             Twinkle(feature);
                             var form = new OperateForm(currentFeatureClass, feature);
                             form.ShowDialog(this);
                         }
                     }
                    break;
            }
            this.operateMode = OperateMode.None;
        }