Exemplo n.º 1
0
 public static void ToFile(LandParcel parcel, string pathExport, ExportFileFormat formatExport)
 {
     try
     {
         if (formatExport == ExportFileFormat.SDR20)
         {
             ServiceExport.ToSDR(parcel, pathExport, ExportFileFormat.SDR20);
         }
         else if (formatExport == ExportFileFormat.SDR33)
         {
             ServiceExport.ToSDR(parcel, pathExport, ExportFileFormat.SDR33);
         }
         else if (formatExport == ExportFileFormat.NXYZC)
         {
             ServiceExport.ToText(parcel, pathExport, ExportFileFormat.NXYZC);
         }
         else if (formatExport == ExportFileFormat.NYXZC)
         {
             ServiceExport.ToText(parcel, pathExport, ExportFileFormat.NYXZC);
         }
         else if (formatExport == ExportFileFormat.CREDO_DAT_TOP)
         {
             ServiceExport.ToText(parcel, pathExport, ExportFileFormat.CREDO_DAT_TOP);
         }
     }
     catch (System.Exception ex)
     {
         MessageBox.Show("Помилка експорту: " + ex.Message);
     }
 }
Exemplo n.º 2
0
    public static bool AllCanBuild(Bounds3Int bounds, List <LandParcel> overlappingLandParcels)
    {
        if (!AllCanBuild(overlappingLandParcels))
        {
            return(false);
        }

        Vector3Int position = new Vector3Int(bounds.min.x, bounds.min.y, bounds.min.z);

        for (position.y = bounds.min.y; position.y <= bounds.max.y; ++position.y)
        {
            for (position.x = bounds.min.x; position.x <= bounds.max.x; ++position.x)
            {
                for (position.z = bounds.min.z; position.z <= bounds.max.z; ++position.z)
                {
                    bool positionContained = false;
                    for (int i = 0, len = overlappingLandParcels.Count; i < len; ++i)
                    {
                        LandParcel landParcel = overlappingLandParcels[i];
                        if (Bounds3Int.Contains(landParcel.bounds, position))
                        {
                            positionContained = true;
                        }
                    }
                    if (!positionContained)
                    {
                        return(false);
                    }
                }
            }
        }
        return(true);
    }
Exemplo n.º 3
0
        // GetParcel

        public static LandParcel GetParcelForCadarstralNumber(BL blockLand, String cadastralNumber)
        {
            LandParcel parcel = null;

            if (blockLand != null)
            {
                parcel = new LandParcel();

                foreach (SR curSR in blockLand.SR)
                {
                    if (curSR.SC == cadastralNumber)
                    {
                        parcel.Info              = GetInfoFromIn4Polygon <SR>(curSR);
                        parcel.Points            = GetPoints2dFromIn4Polygon(curSR);
                        parcel.Lands             = GetLandPoligonsFromIn4Polygon(curSR.CL);
                        parcel.Limiting          = GetLandPoligonsFromIn4Polygon(curSR.OB);
                        parcel.ContoursNeighbors = GetNeighborsForParcel(blockLand, curSR);
                        parcel.OtherLand         = GetOtherLandForParcel(blockLand, curSR);

                        break;
                    }
                }
            }

            //parcel.Neighbors = SortingNeighbors(parcel);

            return(parcel);
        }
Exemplo n.º 4
0
        public void сreate(LandParcel parcel, double scaleTable)
        {
            // ???????
            LandParcel parcelСombinedLand = ServiceTable.СombinedLand(parcel);

            throw new NotImplementedException();
        }
Exemplo n.º 5
0
        public void сreate(LandParcel parcel, double scaleTable)
        {
            LandParcel parcelСombinedLimiting = ServiceTable.СombinedLimiting(parcel);

            string titleTable = ServiceTable.ReplaceValueCodeInTitle(parcelСombinedLimiting, this.Setting);

            foreach (AcDb.DBObject obj in ServiceTable.GetCapTables(titleTable, this.Setting))
            {
                objects.Add(obj);
            }

            foreach (AcDb.DBObject obj in ServiceTable.GetBoundTable(parcelСombinedLimiting.Limiting.Count, this.Setting.TextHeight * 6, this.Setting))
            {
                objects.Add(obj);
            }

            foreach (AcDb.DBObject obj in ServiceTable.GetDataTableLimiting(parcelСombinedLimiting, this.Setting))
            {
                objects.Add(obj);
            }

            string nameBlockTable = ServiceBlockElements.CreateBlock(this.objects, this.Setting.KeyTable);

            ServiceBlockElements.ManualInsertBlock(nameBlockTable, scaleTable);
            objects = new AcDb.DBObjectCollection();
        }
Exemplo n.º 6
0
    public static Bounds3Int MachinePlacementPosition(MachineInfo machineInfo, LandParcel landParcel)
    {
        // Iterate through all positions randomly
        Bounds3Int boundingBox = Bounds3Int.BoundingBox(landParcel.bounds);
        Vector3Int size        = boundingBox.size;

        int[] xPositions = new int[size.x];
        int[] zPositions = new int[size.z];
        Mathx.PopulateRange(xPositions, boundingBox.min.x);
        Mathx.PopulateRange(zPositions, boundingBox.min.z);
        xPositions.Shuffle();
        zPositions.Shuffle();
        int y = boundingBox.min.y;

        for (int i = 0, len = xPositions.Length; i < len; ++i)
        {
            for (int j = 0, jlen = zPositions.Length; j < jlen; ++j)
            {
                Vector3Int position = new Vector3Int(xPositions[i], y, zPositions[j]);
                Bounds3Int bounds   = Bounds3Int.Create(position, machineInfo.size);
                if (MachineSystem.instance.CanCreateMachine(machineInfo, bounds))
                {
                    return(bounds);
                }
            }
        }

        // Unlikely
        return(Bounds3Int.Create(new Vector3Int(0, 0, 0), machineInfo.size));
    }
Exemplo n.º 7
0
    public bool CanBuild(Bounds3Int bounds)
    {
        List <LandParcel> overlap = landParcelHash.GetOverlap(bounds);
        bool valid = LandParcel.AllCanBuild(bounds, overlap);

        ListPool <LandParcel> .Release(overlap);

        return(valid);
    }
Exemplo n.º 8
0
    public bool CanBuild(Vector3Int position)
    {
        List <LandParcel> overlap = landParcelHash.GetOverlap(position);
        bool valid = LandParcel.AllCanBuild(overlap);

        ListPool <LandParcel> .Release(overlap);

        return(valid);
    }
Exemplo n.º 9
0
 public void AddLandParcel(LandParcel land)
 {
     if (landParcelSet.Contains(land))
     {
         Debug.LogWarning("Land parcel added twice", this);
         return;
     }
     landParcelSet.Add(land);
     landParcelHash.Add(land, land.bounds);
 }
Exemplo n.º 10
0
        private void BtnBuildingTable_Click(object sender, EventArgs e)
        {
            if (this.currentParcel == null)
            {
                return;
            }

            BlockTableLand table = new BlockTableLand();

            foreach (string keyTable in this.checkedListBox_TypeTable.CheckedItems)
            {
                SettingTable setTable = this.tableSettings.FindKeyTable(keyTable);
                table.Setting = setTable;
                table.Scale   = this.formSettings.ScaleDrawing;

                if (table.Setting == null)
                {
                    return;
                }

                if (table.StrategyTable.GetType().Equals(typeof(StrategyTableBorderParcel)))
                {
                    table.Parcel = this.currentParcel;
                    table.сreate();
                }
                else if (table.StrategyTable.GetType().Equals(typeof(StrategyTableBorderLimiting)))
                {
                    foreach (LandPolygon polygon in this.currentParcel.Limiting)
                    {
                        LandParcel parcel = new LandParcel
                        {
                            Info   = polygon.Info,
                            Points = polygon.Points
                        };
                        table.Parcel = parcel;
                        table.сreate();
                    }
                }
                else if (table.StrategyTable.GetType().Equals(typeof(StrategyTableLimiting)))
                {
                    table.Parcel = this.currentParcel;
                    table.сreate();
                }
                else if (table.StrategyTable.GetType().Equals(typeof(StrategyTableStakeOutPoints)))
                {
                    table.Parcel = this.currentParcel;
                    table.сreate();
                }
            }
        }
Exemplo n.º 11
0
        public static void ToText(LandParcel parcel, string pathExport, ExportFileFormat formatExport)
        {
            string txtData = "#Parcel_" + parcel.FindInfo("SC").Value;

            if (formatExport == ExportFileFormat.NXYZC)
            {
                txtData += "\r\n# NumberPoint; Northing; Easting ; Elevation; Code";
            }
            else if (formatExport == ExportFileFormat.NYXZC)
            {
                txtData += "\r\n# NumberPoint; Easting;  Northing; Elevation; Code";
            }
            else if (formatExport == ExportFileFormat.CREDO_DAT_TOP)
            {
                //txtData += "\r\n# NumberPoint; Code;  Northing; Easting; Elevation; ???";
            }

            int index = 0;

            foreach (AcGe.Point2d point in parcel.Points)
            {
                index++;

                if (formatExport == ExportFileFormat.NXYZC)
                {
                    txtData += "\r\n" + index.ToString("0000") + "; " +
                               point.Y.ToString("0.000").Replace(",", ".") + "; " +
                               point.X.ToString("0.000").Replace(",", ".") + "; 0.000; точка_межі";
                }
                else if (formatExport == ExportFileFormat.NYXZC)
                {
                    txtData += "\r\n" + index.ToString("0000") + "; " +
                               point.X.ToString("0.000").Replace(",", ".") + "; " +
                               point.Y.ToString("0.000").Replace(",", ".") + "; 0.000; точка_межі";
                }
                else if (formatExport == ExportFileFormat.CREDO_DAT_TOP)
                {
                    txtData += "\r\n" + DataSDR.Format(index.ToString(), 8, AlignmentText.ToLeft) + " 001 " +
                               DataSDR.Format(point.Y.ToString("0.000").Replace(",", "."), 12, AlignmentText.ToRight) + " " +
                               DataSDR.Format(point.X.ToString("0.000").Replace(",", "."), 12, AlignmentText.ToRight) + " " +
                               DataSDR.Format(("0.000"), 12, AlignmentText.ToRight) + " " + "   0";
                }
            }

            SaveFile(txtData, pathExport);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Об'єднуе площі однотипних обмежень.
        /// </summary>
        /// <param name="parcel">Ділянка з обмеженнями.</param>
        /// <returns>
        /// Повертає <see cref="T:LoSa.Land.Parcel.LandParcel"/>, що містить обеднані площі однотипних обмежень.
        /// </returns>

        internal static LandParcel СombinedLimiting(LandParcel parcel)
        {
            LandParcel newParcel = new LandParcel();

            bool isNewLimiting = true;

            foreach (LandPolygon limiting in parcel.Limiting)
            {
                if (newParcel.Limiting.Count == 0)
                {
                    newParcel.Limiting.Add(limiting);
                }
                else
                {
                    isNewLimiting = true;
                    foreach (LandPolygon newLimiting in newParcel.Limiting)
                    {
                        if (limiting.FindInfo("OK").Value.Equals(newLimiting.FindInfo("OK").Value) &&
                            limiting.FindInfo("OX").Value.Equals(newLimiting.FindInfo("OX").Value))
                        {
                            double oldArea =
                                Convert.ToDouble(
                                    newLimiting.FindInfo("AO").Value.Replace(".", ",")
                                    );
                            double newArea =
                                Convert.ToDouble(
                                    limiting.FindInfo("AO").Value.Replace(".", ",")
                                    );

                            newLimiting.FindInfo("AO").Value = (oldArea + newArea).ToString("").Replace(",", ".");
                            isNewLimiting = false;
                        }
                    }

                    if (isNewLimiting == true)
                    {
                        newParcel.Limiting.Add(limiting);
                    }
                }
            }

            return(newParcel);
        }
Exemplo n.º 13
0
    public static bool AllCanBuild(List <LandParcel> landParcels)
    {
        bool valid = false;

        // Need to check that every point in the machine is within valid parcels
        for (int i = 0, len = landParcels.Count; i < len; ++i)
        {
            LandParcel landParcel = landParcels[i];
            if (landParcel.flags == LandParcelFlags.Restricted)
            {
                return(false);
            }
            if (landParcel.flags == LandParcelFlags.Valid)
            {
                valid = true;
            }
        }

        return(valid);
    }
Exemplo n.º 14
0
        /// <summary>
        /// Замінює у заголовку таблиці кода на відповідні їм значення.
        /// </summary>
        /// <param name="polygon">Ділянка, що є вихідною для таблиці.</param>
        /// <param name="settingTable">Налаштування таблиці.</param>
        /// <returns>
        /// Повертає  <see cref="T:System.Sting"/> після заміни кодів на відповідні їм значення.
        /// </returns>

        internal static String ReplaceValueCodeInTitle(LandParcel polygon, SettingTable settingTable)
        {
            string titleTable = settingTable.Title;

            List <string> keys = settingTable.GetCodeAddTitle();

            foreach (string key in keys)
            {
                LandInfo info = polygon.FindInfo(key);

                if (info != null)
                {
                    titleTable = titleTable.Replace("/*" + info.Key + "*/", info.Value);
                }
                else
                {
                    titleTable = titleTable.Replace("/*" + key + "*/", "< Невірний код /*" + key + "*/>");
                }
            }
            return(titleTable);
        }
Exemplo n.º 15
0
        public static LandPolygon GetPolygonForCadarstralNumber(BL blockLand, String cadastralNumber)
        {
            LandParcel parcel = null;

            if (blockLand != null)
            {
                parcel = new LandParcel();

                foreach (SR curSR in blockLand.SR)
                {
                    if (curSR.SC == cadastralNumber)
                    {
                        parcel.Info   = GetInfoFromIn4Polygon <SR>(curSR);
                        parcel.Points = GetPoints2dFromIn4Polygon(curSR);

                        break;
                    }
                }
            }

            return(parcel);
        }
Exemplo n.º 16
0
        public static void ToSDR(LandParcel parcel, string pathExport, ExportFileFormat formatExport)
        {
            DataSDR sdr = new DataSDR();

            HeaderRecordSDR hrSDR = new HeaderRecordSDR();

            sdr.Recording.Add(hrSDR);

            JobRecordSDR jrSDR = new JobRecordSDR();

            jrSDR.JobName = "Parcel_" + parcel.FindInfo("SC").Value;
            sdr.Recording.Add(jrSDR);

            int    index   = 0;
            string sdrData = "";

            foreach (AcGe.Point2d point in parcel.Points)
            {
                index++;
                CoordinatesRecordSDR crSDR =
                    new CoordinatesRecordSDR(
                        index.ToString(),
                        new AcGe.Point3d(new AcGe.Plane(), point),
                        parcel.FindInfo("SC").Value);
                sdr.Recording.Add(crSDR);

                if (formatExport == ExportFileFormat.SDR20)
                {
                    sdrData = sdr.ToStringSDR <FormatSDR20>();
                }
                else if (formatExport == ExportFileFormat.SDR33)
                {
                    sdrData = sdr.ToStringSDR <FormatSDR33>();
                }
            }

            SaveFile(sdrData, pathExport);
        }
Exemplo n.º 17
0
        public void сreate(LandParcel polygon, double scale)
        {
            string titleTable = ServiceTable.ReplaceValueCodeInTitle(polygon, this.Setting);

            foreach (AcDb.DBObject obj in ServiceTable.GetCapTables(titleTable, this.Setting))
            {
                objects.Add(obj);
            }

            foreach (AcDb.DBObject obj in ServiceTable.GetBoundTable(polygon.Points.Count + 1, this.Setting.TextHeight * 2, this.Setting))
            {
                objects.Add(obj);
            }

            foreach (AcDb.DBObject obj in ServiceTable.GetDataTableStakeOutParcelPoints(polygon, this.Setting))
            {
                objects.Add(obj);
            }

            string nameBlockTable = ServiceBlockElements.CreateBlock(this.objects, this.Setting.KeyTable);

            ServiceBlockElements.ManualInsertBlock(nameBlockTable, scale);
            objects = new AcDb.DBObjectCollection();
        }
Exemplo n.º 18
0
        /// <summary>
        /// Створює коллекцію текстових обектів значень данних таблиці обмежень земельної ділянки.
        /// </summary>
        /// <param name="parcel">Ділянка, що є вихідною для таблиці.</param>
        /// <param name="settingTable">Налаштування таблиці.</param>
        /// <returns>
        ///  Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить текстові значення данний таблиці обмежень земельної ділянки.
        /// </returns>

        internal static AcDb.DBObjectCollection GetDataTableLimiting(LandParcel parcel, SettingTable settingTable)
        {
            AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection();

            AcDb.MText   valueMText;
            AcGe.Point3d insertPoint;
            AcDb.Line    lineRows;

            LandPolygon polygonLimiting;

            double steepRow    = settingTable.TextHeight * 6;
            double heightTable = settingTable.GetHeightCapTable() * -1;

            List <HatchPolygon> listMissingHatch = new List <HatchPolygon>();

            for (int index = 0; index < parcel.Limiting.Count; index++)
            {
                polygonLimiting = parcel.Limiting.ToArray()[index];

                double colWidth = 0;

                if (index > 0)
                {
                    lineRows = new AcDb.Line(
                        new AcGe.Point3d(0, heightTable, 0),
                        new AcGe.Point3d(settingTable.GetWidthTable(), heightTable, 0));

                    objects.Add(lineRows);
                }

                heightTable -= steepRow;



                foreach (ColumnTable col in settingTable.Columns)
                {
                    colWidth += col.Width;

                    insertPoint = new AcGe.Point3d();
                    insertPoint = new AcGe.Point3d(colWidth - col.Width / 2, (heightTable + steepRow / 2), 0);

                    valueMText                   = new AcDb.MText();
                    valueMText.Width             = col.Width * 0.9;
                    valueMText.TextHeight        = settingTable.TextHeight;
                    valueMText.LineSpaceDistance = settingTable.TextHeight * 1.5;
                    valueMText.Attachment        = AcDb.AttachmentPoint.MiddleCenter;
                    valueMText.Location          = insertPoint;

                    if (col.Format.IndexOf("LegendLimiting") > -1)
                    {
                        AcGe.Point2dCollection pointsHatch = new AcGe.Point2dCollection(new AcGe.Point2d[]
                        {
                            new AcGe.Point2d(insertPoint.X - col.Width / 2 + 2, heightTable + steepRow - 2),
                            new AcGe.Point2d(insertPoint.X - col.Width / 2 + 2, heightTable + 2),
                            new AcGe.Point2d(insertPoint.X - col.Width / 2 + col.Width - 2, heightTable + 2),
                            new AcGe.Point2d(insertPoint.X - col.Width / 2 + col.Width - 2, heightTable + steepRow - 2)
                        });

                        AcDb.Polyline2d polylineLimiting = ServiceSimpleElements.CreatePolyline2d(pointsHatch, true);
                        AcDb.Hatch      hatch            =
                            ServiceSimpleElements.CreateHatch(ServiceCAD.InsertObject(polylineLimiting), true);

                        HatchPolygon hatchLimiting = HatchPolygon.GetHatchLimiting(polygonLimiting);

                        if (hatchLimiting != null)
                        {
                            hatch.ColorIndex = hatchLimiting.ColorIndex;
                            hatch.SetHatchPattern(AcDb.HatchPatternType.UserDefined, hatchLimiting.Pattern.Name);
                            hatch.PatternAngle = hatchLimiting.Pattern.Angle;
                            hatch.PatternSpace = hatchLimiting.Pattern.Space;
                        }
                        else
                        {
                            string type = polygonLimiting.FindInfo("OK").Value;
                            string name = polygonLimiting.FindInfo("OX").Value;
                            listMissingHatch.Add(new HatchPolygon(type, name, 0, PatternHatch.DEFAULT));
                        }

                        objects.Add(hatch);
                        polylineLimiting = ServiceSimpleElements.CreatePolyline2d(pointsHatch, true);
                        objects.Add(polylineLimiting);
                    }
                    else if (col.Format.IndexOf("CodeLimiting") > -1)
                    {
                        valueMText.Contents = polygonLimiting.FindInfo("OK").Value;
                        objects.Add(valueMText);
                    }
                    else if (col.Format.IndexOf("NameLimiting") > -1)
                    {
                        valueMText.Contents = polygonLimiting.FindInfo("OX").Value;
                        objects.Add(valueMText);
                    }
                    else if (col.Format.IndexOf("LegalActsLimiting") > -1)
                    {
                        valueMText.Contents = polygonLimiting.FindInfo("OD").Value;
                        objects.Add(valueMText);
                    }
                    else if (col.Format.IndexOf("AreaLimiting") > -1)
                    {
                        double area = Convert.ToDouble(polygonLimiting.FindInfo("AO").Value.Replace(".", ","));
                        valueMText.Contents = (area / 10000).ToString("0.0000").Replace(",", ".");;
                        objects.Add(valueMText);
                    }
                }
            }

            if (listMissingHatch.Count > 0)
            {
                CurrentCAD.Editor.WriteMessage("\n\nПобудова таблиці омеженнь\n Не визначено штриховку: \n");
                CurrentCAD.Editor.WriteMessage(ServiceXml.GetStringXml <List <HatchPolygon> >(listMissingHatch));
            }

            return(objects);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Створює коллекцію текстових обектів значень данних таблиці виносу внатуру меж земельної ділянки.
        /// </summary>
        /// <param name="polygon">Земельна ділянка.</param>
        /// <param name="settingTable">Налаштування таблиці.</param>
        /// <returns>
        ///  Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить текстові значення данний таблиці виносу внатуру меж земельної ділянки.
        /// </returns>
        internal static AcDb.DBObjectCollection GetDataTableStakeOutParcelPoints(LandParcel polygon, SettingTable settingTable)
        {
            List <StakeOutParcelPoint> stakeoutPoints = polygon.StakeOutParcelPoints;

            //stakeoutPoints.Sort((x, y) => y.PointStation.Name.CompareTo(x.PointStation.Name));

            AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection();

            AcDb.DBText  textValue;
            AcGe.Point3d insertPoint;

            //AcGe.Point2d backPoint, stationPoint, parcelPoint;

            double heightTable = (settingTable.GetHeightCapTable() + settingTable.TextHeight) * -1;

            int index = -1;

            foreach (StakeOutParcelPoint stakeoutPoint in stakeoutPoints)
            {
                index++;
                double colWidth = 0;
                heightTable += settingTable.TextHeight * 2 * index;

                foreach (ColumnTable col in settingTable.Columns)
                {
                    colWidth += col.Width;

                    insertPoint = new AcGe.Point3d();
                    insertPoint = new AcGe.Point3d
                                  (
                        colWidth - col.Width / 2,
                        (settingTable.GetHeightCapTable() + (index + 1) * settingTable.TextHeight * 2) * -1,
                        0
                                  );

                    textValue = new AcDb.DBText();

                    textValue.Height         = settingTable.TextHeight;
                    textValue.Justify        = AcDb.AttachmentPoint.BottomCenter;
                    textValue.Position       = settingTable.BasePointDrawing.Add(insertPoint.GetAsVector());
                    textValue.AlignmentPoint = textValue.Position;

                    if (col.Format.IndexOf("Number") > -1)
                    {
                        textValue.TextString = stakeoutPoint.Name;
                    }
                    else if (col.Format.IndexOf("X") > -1)
                    {
                        textValue.TextString = stakeoutPoint.Coordinates.X.ToString("0.00");
                    }
                    else if (col.Format.IndexOf("Y") > -1)
                    {
                        textValue.TextString = stakeoutPoint.Coordinates.Y.ToString("0.00");
                    }
                    else if (col.Format.IndexOf("LengthLine") > -1)
                    {
                        textValue.TextString = stakeoutPoint.Distance.ToString("0.00");
                    }
                    else if (col.Format.IndexOf("DirAngle") > -1)
                    {
                        textValue.TextString = stakeoutPoint.DirAngleToString(AcRx.AngularUnitFormat.DegreesMinutesSeconds);
                    }
                    else if (col.Format.IndexOf("InnerAngle") > -1)
                    {
                        textValue.TextString = stakeoutPoint.LeftlAngleToString(AcRx.AngularUnitFormat.DegreesMinutesSeconds);
                    }
                    else if (col.Format.IndexOf("BasePoints_dirAngle") > -1)
                    {
                        textValue.TextString = stakeoutPoint.PointStation.Name;
                    }
                    else if (col.Format.IndexOf("BasePoints_innerAngle") > -1)
                    {
                        textValue.TextString = stakeoutPoint.PointStation.Name
                                               + " -> "
                                               + stakeoutPoint.PointOrientation.Name;
                    }
                    else
                    {
                        textValue.TextString = "None";
                    }

                    textValue.TextString = textValue.TextString.Replace(",", ".");
                    textValue.TextString = FormatAngleValue(textValue.TextString);

                    objects.Add(textValue);
                }
            }

            return(objects);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Створює коллекцію текстових обектів значень данних таблиці межі земельної ділянки.
        /// </summary>
        /// <param name="polygon">Ділянка, що є вихідною для таблиці.</param>
        /// <param name="settingTable">Налаштування таблиці.</param>
        /// <returns>
        ///  Повертає <see cref="T:AcDb.DBObjectCollection"/>, що містить текстові значення данний таблиці межі земельної ділянки.
        /// </returns>

        internal static AcDb.DBObjectCollection GetDataTableBorderPolygon(LandParcel polygon, SettingTable settingTable)
        {
            AcDb.DBObjectCollection objects = new AcDb.DBObjectCollection();

            AcDb.DBText  textValue;
            AcGe.Point3d insertPoint;

            AcGe.Point2d backPoint, currentPoint, frontPoint;

            double heightTable = (settingTable.GetHeightCapTable() + settingTable.TextHeight) * -1;

            for (int index = 0; index <= polygon.Points.Count; index++)//(Point2d point in polygon.Points)
            {
                double colWidth = 0;
                heightTable += settingTable.TextHeight * 2 * index;

                if (index == 0)
                {
                    backPoint    = polygon.Points.ToArray()[polygon.Points.Count - 1];
                    currentPoint = polygon.Points.ToArray()[index];
                    frontPoint   = polygon.Points.ToArray()[index + 1];
                }
                else if (index == polygon.Points.Count - 1)
                {
                    backPoint    = polygon.Points.ToArray()[index - 1];
                    currentPoint = polygon.Points.ToArray()[index];
                    frontPoint   = polygon.Points.ToArray()[0];
                }
                else if (index == polygon.Points.Count)
                {
                    backPoint    = polygon.Points.ToArray()[index - 1];
                    currentPoint = polygon.Points.ToArray()[0];
                    frontPoint   = polygon.Points.ToArray()[1];
                }
                else
                {
                    backPoint    = polygon.Points.ToArray()[index - 1];
                    currentPoint = polygon.Points.ToArray()[index];
                    frontPoint   = polygon.Points.ToArray()[index + 1];
                }

                foreach (ColumnTable col in settingTable.Columns)
                {
                    colWidth += col.Width;

                    insertPoint = new AcGe.Point3d();
                    insertPoint = new AcGe.Point3d(colWidth - col.Width / 2, (settingTable.GetHeightCapTable() + (index + 1) * settingTable.TextHeight * 2) * -1, 0);

                    textValue = new AcDb.DBText();

                    textValue.Height         = settingTable.TextHeight;
                    textValue.Justify        = AcDb.AttachmentPoint.BottomCenter;
                    textValue.Position       = settingTable.BasePointDrawing.Add(insertPoint.GetAsVector());
                    textValue.AlignmentPoint = textValue.Position;

                    if (col.Format.IndexOf("Number") > -1)
                    {
                        if (index == polygon.Points.Count)
                        {
                            textValue.TextString = "1";
                        }
                        else
                        {
                            textValue.TextString = Math.Abs(index + 1).ToString();
                        }
                    }
                    else if (col.Format.IndexOf("X") > -1)
                    {
                        textValue.TextString = currentPoint.X.ToString("0.00");
                    }
                    else if (col.Format.IndexOf("Y") > -1)
                    {
                        textValue.TextString = currentPoint.Y.ToString("0.00");
                    }
                    else if (col.Format.IndexOf("LengthLine") > -1)
                    {
                        if (index < polygon.Points.Count)
                        {
                            textValue.Position       = textValue.Position.Add(new AcGe.Vector3d(0, settingTable.TextHeight * -1, 0));
                            textValue.AlignmentPoint = textValue.Position;
                            textValue.TextString     = currentPoint.GetDistanceTo(frontPoint).ToString("0.00");
                        }
                    }
                    else if (col.Format.IndexOf("DirAngle") > -1)
                    {
                        if (index < polygon.Points.Count)
                        {
                            textValue.Position       = textValue.Position.Add(new AcGe.Vector3d(0, settingTable.TextHeight * -1, 0));
                            textValue.AlignmentPoint = textValue.Position;
                            double angle = ServiceGeodesy.GetDirAngle(currentPoint, frontPoint);
                            textValue.TextString = AcRx.Converter.AngleToString(angle, AcRx.AngularUnitFormat.DegreesMinutesSeconds, 3);
                        }
                    }
                    else if (col.Format.IndexOf("InnerAngle") > -1)
                    {
                        double angle = ServiceGeodesy.GetRightAngle(backPoint, currentPoint, frontPoint);
                        textValue.TextString = AcRx.Converter.AngleToString(angle, AcRx.AngularUnitFormat.DegreesMinutesSeconds, 3);
                    }
                    else
                    {
                        textValue.TextString = "None";
                    }

                    textValue.TextString = textValue.TextString.Replace(",", ".");

                    for (int i = 0; i < 10; i++)
                    {
                        textValue.TextString = textValue.TextString
                                               .Replace("°" + i.ToString() + "'", "°" + i.ToString("00") + "'");
                    }
                    for (int i = 0; i < 10; i++)
                    {
                        textValue.TextString = textValue.TextString
                                               .Replace("'" + i.ToString() + "\"", "'" + i.ToString("00") + "\"");
                    }

                    objects.Add(textValue);
                }
            }

            return(objects);
        }
Exemplo n.º 21
0
 public BlockTableLand(LandParcel parcel, SettingTable settingTable)
 {
     this.Parcel  = parcel;
     this.Setting = settingTable;
 }
Exemplo n.º 22
0
        private void ComboBoxNumberParcel_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.Text          = this.comboBoxNumberParcel.SelectedItem.ToString();
            this.currentParcel = ServiceIn4.GetParcelForCadarstralNumber
                                     (this.currentBlockLand, this.comboBoxNumberParcel.SelectedItem.ToString());
            if (!this.idCurrentHatchParcel.IsNull)
            {
                ServiceCAD.DeleteObject(this.idCurrentHatchParcel);
                ServiceCAD.DeleteObjects(this.idNeighborsCurrenParcel);
            }

            serviceParcel = new ServiceParcel(this.currentParcel, this.formSettings);

            AcGe.Point2dCollection pointsCurrentHatchParcel =
                ServiceSimpleElements.Offset(this.currentParcel.Points, this.offsetBlockLandView);
            AcDb.ObjectId idPolyline2d =
                ServiceCAD.InsertObject(ServiceSimpleElements.CreatePolyline2d(pointsCurrentHatchParcel, true));
            AcDb.Hatch curHatch =
                ServiceSimpleElements.CreateHatch(new AcDb.ObjectIdCollection(new AcDb.ObjectId[] { idPolyline2d }));
            this.idCurrentHatchParcel =
                ServiceCAD.InsertObject(curHatch);
            ServiceCAD.DeleteObject(idPolyline2d);


            // =======================================================

            if (this.currentParcel.StakeOutParcelPoints != null)
            {
                this.currentParcel.StakeOutParcelPoints.Clear();
            }

            StakeOutParcelPoint stakeOutParcelPoint;

            this.dataGridView_StakeOut.ClearSelection();
            this.dataGridView_StakeOut.Rows.Clear();

            int indexPoint = 0;

            object[] row = new object[2];

            foreach (AcGe.Point2d point in this.currentParcel.Points)
            {
                indexPoint++;

                stakeOutParcelPoint = new StakeOutParcelPoint
                {
                    ScaleDrawing = this.drawingSettings.Scale.Value,
                    Name         = indexPoint.ToString(),
                    Coordinates  = point
                };

                this.currentParcel.StakeOutParcelPoints.Add(stakeOutParcelPoint);
                row[0] = false;
                row[1] = indexPoint.ToString();

                this.dataGridView_StakeOut.Rows.Add(row);
            }

            SetColPointStationAndOrientationItems();
            AutoSearchingStationAndOrientationForAllPoints();

            this.dataGridView_StakeOut.Update();

            ReLoad_treeViewParcel();
        }
Exemplo n.º 23
0
 public void RemoveLandParcel(LandParcel land)
 {
     landParcelSet.Remove(land);
     landParcelHash.Remove(land, land.bounds);
 }