ArcGISCompare.FeatureMappingData.CalcMZTransform C# (CSharp) Метод

CalcMZTransform() публичный Метод

public CalcMZTransform ( IWorkspace theInWS, IWorkspace theOutWS ) : int
theInWS IWorkspace
theOutWS IWorkspace
Результат int
    public int CalcMZTransform(IWorkspace theInWS, IWorkspace theOutWS)
    {
      IFeatureClass theInFC = GeoDbProcs.GetFeatureClass(theInWS, this.srcFC);
      IFeatureClass theOutFC = GeoDbProcs.GetFeatureClass(theOutWS, this.destFC);

      IField theInF = theInFC.Fields.get_Field(theInFC.Fields.FindField(theInFC.ShapeFieldName));
      IField theOutF = theOutFC.Fields.get_Field(theOutFC.Fields.FindField(theOutFC.ShapeFieldName));

      IGeometryDef inDef = theInF.GeometryDef;
      IGeometryDef outDef = theOutF.GeometryDef;

      if (inDef.HasZ == outDef.HasZ)
      {
        if (inDef.HasM == outDef.HasM) { return 0; }
        if (inDef.HasM == false && outDef.HasM == true) { return 4; }  // Add M Values
        if (inDef.HasM == true && outDef.HasM == false) { return 3; }  // Remove M
      }

      if (inDef.HasM == outDef.HasM)
      {
        if (inDef.HasZ == outDef.HasZ) { return 0; }
        if (inDef.HasZ == false && outDef.HasZ == true) { return 2; }  // Add Z Values
        if (inDef.HasZ == true && outDef.HasZ == false) { return 1; }  // Remove Z
      }

      if (inDef.HasM == false && outDef.HasM == true && inDef.HasZ == false && outDef.HasZ == true) { return 6; }  // Add Both M and Z
      return 5; // Remove both M and Z
    }

Usage Example

Пример #1
0
        public int LoadAllMappings(ListBox lstBox, IWorkspace sWkSpc, IWorkspace dWkSpc)
        {
            OleDbCommand theCMD;
              OleDbDataReader theReader;
              int retVal = 0;
              String theSQL = "";
              int ser = 0;
              int srcG, destG, geomT, fCount;
              String srcC, destC;
              FeatureMappingData theMap;

              try
              {
            // retrieve the contents of the FeatureMappings table
            theSQL = "SELECT * FROM [FeatureMappings]";
            theCMD = new OleDbCommand(theSQL, theConn);

            checkOpen();
            theReader = theCMD.ExecuteReader(System.Data.CommandBehavior.CloseConnection);

            while (theReader.Read())
            {
              // the serial number is key to tracking linkages of the objects while in the database
              ser = theReader.GetInt32(0);      // FeatureMappings.SerialNumber
              srcC = theReader.GetString(2);    // FeatureMappings.sourceClass
              destC = theReader.GetString(3);   // FeatureMappings.destinationClass
              srcG = theReader.GetInt32(4);     // FeatureMappings.sourceGeom
              destG = theReader.GetInt32(5);    // FeatureMappings.destinationGeom
              geomT = theReader.GetInt32(6);    // FeatureMappings.geomTransform
              fCount = theReader.GetInt32(7);   // FeatureMappings.featureCount

              // create the FeatureMappingData object and add to the lstMappings ListBox
              theMap = new FeatureMappingData("", srcC, destC, (esriGeometryType)srcG, (esriGeometryType)destG, ser);
              lstBox.Items.Add(theMap);
              Application.DoEvents();
              theMap.UpdateFeatureCount(fCount);
              theMap.zmTransform = theMap.CalcMZTransform(sWkSpc, dWkSpc);

              // get associated AttributeMappingData objects based on the SerialNumber (ser)
              LoadAttributeMappings(theMap, dWkSpc, ser);

              // get prior DataLoadError objects based on the SerialNumber (ser)
              LoadDataErrors(theMap, ser);
            }

            retVal = ser + 1;
            return retVal;
              }
              catch (Exception ex) { return -1; }
        }