Inheritance: INotifyPropertyChanged
Exemplo n.º 1
0
        private static void WriteLine(ref XmlWriter writer, ParcelLineRow record, ref DocumentEntry documentType, Int32 to)
        {
            if (IncompleteLine(record))
            {
                return; // incomplete line
            }
            if (to == -1)
            {
                to = record.GetTo();
            }

            writer.WriteStartElement("line");

            writer.WriteElementString("fromPoint", record.GetFrom().ToString());
            writer.WriteElementString("toPoint", to.ToString());
            writer.WriteElementString("bearing", record.GetBearing(false).ToString(_doubleFormat));
            writer.WriteElementString("distance", record.GetChordDistance().ToString(_doubleFormat));
            writer.WriteElementString("category", record.Category.ToString());
            if (documentType != null)
            {
                writer.WriteElementString("type", documentType.Type.ToString());
            }

            double radius = record.GetRadius();

            if ((radius != 0.0) && (record.CenterPoint != null))
            {
                writer.WriteElementString("radius", radius.ToString(_doubleFormat));
                writer.WriteElementString("centerPoint", record.CenterPoint.ToString());
            }

            writer.WriteEndElement();
        }
Exemplo n.º 2
0
        private static void WriteLines(ref XmlWriter writer, ref ParcelData parcelData, ref DocumentEntry documentType, ref Configuration configuration)
        {
            writer.WriteStartElement("lines");

            // Write non radial lines
            ObservableCollection <ParcelLineRow> parcelRecord = parcelData.GetRecordInfo();
            Int32 firstId = -1, index = 0, count = 0;

            foreach (ParcelLineRow record in parcelRecord)
            {
                if (!IncompleteLine(record))
                {
                    count++;
                }
            }

            foreach (ParcelLineRow record in parcelRecord)
            {
                if (IncompleteLine(record))
                {
                    continue;
                }

                index++;
                if ((firstId == -1) && (record.Category == LineCategory.Boundary))
                {
                    firstId = record.GetFrom();
                }
                Int32 overrideTo = count == index && count != 1 ? firstId : -1;

                if (record.Category != LineCategory.Radial)
                {
                    WriteLine(ref writer, record, ref documentType, overrideTo);
                }
            }

            // Write radial lines
            foreach (ParcelLineRow record in parcelRecord)
            {
                if (record.CenterPoint == null)
                {
                    continue;
                }

                ParcelLineRow radialRecord = new ParcelLineRow(ref configuration);

                radialRecord.From     = record.From;
                radialRecord.To       = record.CenterPoint.ToString();
                radialRecord.Bearing  = GeometryUtil.RadianToDegree(record.RadialBearing1.GetValueOrDefault(0)).ToString();
                radialRecord.Distance = record.Radius;
                radialRecord.Category = LineCategory.Radial;
                WriteLine(ref writer, radialRecord, ref documentType, -1);

                radialRecord.From    = record.To;
                radialRecord.Bearing = GeometryUtil.RadianToDegree(record.RadialBearing2.GetValueOrDefault(0)).ToString();
                WriteLine(ref writer, radialRecord, ref documentType, -1);
            }

            writer.WriteEndElement(); // lines
        }
Exemplo n.º 3
0
        // This routine does not write out points, but it does write the start location
        private static void WriteConstructionData(ref XmlWriter writer, ref ParcelData parcelData, ref PointDictionary pointDictionary, ref MapPoint projectedStartPoint, ref Configuration configuration, ParcelLineRow record)
        {
            Int32 pointId = record.GetFrom();
              if (!pointDictionary.ContainsKey(pointId))
            return;

              // Rather than using the point from the dictionary, the client should pass in a projected point.
              // ESRI.ArcGIS.Client.Geometry.MapPoint startPoint = pointDictionary[pointId];

              ESRI.ArcGIS.Client.Geometry.MapPoint startPoint = projectedStartPoint;
              if (startPoint == null)
            return;

              writer.WriteStartElement("constructionData");
              writer.WriteStartElement("constructionAdjustment");
              writer.WriteStartElement("startPoint");

              double xM = startPoint.X;
              double yM = startPoint.Y;
              if (configuration.HasSpatialReferenceUnit)
              {
            xM *= configuration.SpatialReferenceUnitsPerMeter;
            yM *= configuration.SpatialReferenceUnitsPerMeter;
              }

               writer.WriteElementString("unjoinedPointNo", pointId.ToString());
              writer.WriteElementString("x", xM.ToString(_doubleFormat));
              writer.WriteElementString("y", yM.ToString(_doubleFormat));

              writer.WriteEndElement(); // startPoint

              if (parcelData.CompassRuleApplied)
            writer.WriteElementString("type", "0");  // compass rule = 0

              writer.WriteEndElement(); // constructionAdjustment
              writer.WriteEndElement(); // constructionData
        }
Exemplo n.º 4
0
 private static bool IncompleteLine(ParcelLineRow record)
 {
     return (record.GetFrom() == 0) || (record.GetTo() == 0) || (record.GetDistance() == 0);
 }
Exemplo n.º 5
0
        private static void WriteLines(ref XmlWriter writer, ref ParcelData parcelData, ref DocumentEntry documentType, ref Configuration configuration)
        {
            writer.WriteStartElement("lines");

              // Write non radial lines
              ObservableCollection<ParcelLineRow> parcelRecord = parcelData.GetRecordInfo();
              Int32 firstId = -1, index = 0, count = 0;
              foreach (ParcelLineRow record in parcelRecord)
            if (!IncompleteLine(record))
              count++;

              foreach (ParcelLineRow record in parcelRecord)
              {
            if (IncompleteLine(record))
              continue;

            index++;
            if ((firstId == -1) && (record.Category == LineCategory.Boundary))
              firstId = record.GetFrom();
            Int32 overrideTo = count == index && count != 1 ? firstId : -1;

            if (record.Category != LineCategory.Radial)
              WriteLine(ref writer, record, ref documentType, overrideTo);
              }

              // Write radial lines
              foreach (ParcelLineRow record in parcelRecord)
              {
            if (record.CenterPoint == null)
              continue;

            ParcelLineRow radialRecord = new ParcelLineRow(ref configuration);

            radialRecord.From = record.From;
            radialRecord.To = record.CenterPoint.ToString();
            radialRecord.Bearing = GeometryUtil.RadianToDegree(record.RadialBearing1.GetValueOrDefault(0)).ToString();
            radialRecord.Distance = record.Radius;
            radialRecord.Category = LineCategory.Radial;
            WriteLine(ref writer, radialRecord, ref documentType, -1);

            radialRecord.From = record.To;
            radialRecord.Bearing = GeometryUtil.RadianToDegree(record.RadialBearing2.GetValueOrDefault(0)).ToString();
            WriteLine(ref writer, radialRecord, ref documentType, -1);
              }

              writer.WriteEndElement(); // lines
        }
Exemplo n.º 6
0
        private static void WriteLine(ref XmlWriter writer, ParcelLineRow record, ref DocumentEntry documentType, Int32 to)
        {
            if (IncompleteLine(record))
            return;  // incomplete line

              if (to == -1)
            to = record.GetTo();

              writer.WriteStartElement("line");

              writer.WriteElementString("fromPoint", record.GetFrom().ToString());
              writer.WriteElementString("toPoint", to.ToString());
              writer.WriteElementString("bearing", record.GetBearing(false).ToString(_doubleFormat));
              writer.WriteElementString("distance", record.GetChordDistance().ToString(_doubleFormat));
              writer.WriteElementString("category", record.Category.ToString());
              if (documentType != null)
            writer.WriteElementString("type", documentType.Type.ToString());

              double radius = record.GetRadius();

              if ((radius != 0.0) && (record.CenterPoint != null))
              {
            writer.WriteElementString("radius", radius.ToString(_doubleFormat));
            writer.WriteElementString("centerPoint", record.CenterPoint.ToString());
              }

              writer.WriteEndElement();
        }
Exemplo n.º 7
0
 private static bool IncompleteLine(ParcelLineRow record)
 {
     return((record.GetFrom() == 0) || (record.GetTo() == 0) || (record.GetDistance() == 0));
 }
Exemplo n.º 8
0
        // This routine does not write out points, but it does write the start location

        private static void WriteConstructionData(ref XmlWriter writer, ref ParcelData parcelData, ref PointDictionary pointDictionary, ref MapPoint projectedStartPoint, ref Configuration configuration, ParcelLineRow record)
        {
            Int32 pointId = record.GetFrom();

            if (!pointDictionary.ContainsKey(pointId))
            {
                return;
            }

            // Rather than using the point from the dictionary, the client should pass in a projected point.
            // ESRI.ArcGIS.Client.Geometry.MapPoint startPoint = pointDictionary[pointId];

            ESRI.ArcGIS.Client.Geometry.MapPoint startPoint = projectedStartPoint;
            if (startPoint == null)
            {
                return;
            }

            writer.WriteStartElement("constructionData");
            writer.WriteStartElement("constructionAdjustment");
            writer.WriteStartElement("startPoint");

            double xM = startPoint.X;
            double yM = startPoint.Y;

            if (configuration.HasSpatialReferenceUnit)
            {
                xM *= configuration.SpatialReferenceUnitsPerMeter;
                yM *= configuration.SpatialReferenceUnitsPerMeter;
            }

            writer.WriteElementString("unjoinedPointNo", pointId.ToString());
            writer.WriteElementString("x", xM.ToString(_doubleFormat));
            writer.WriteElementString("y", yM.ToString(_doubleFormat));

            writer.WriteEndElement(); // startPoint

            if (parcelData.CompassRuleApplied)
            {
                writer.WriteElementString("type", "0"); // compass rule = 0
            }
            writer.WriteEndElement();                   // constructionAdjustment
            writer.WriteEndElement();                   // constructionData
        }