Exemplo n.º 1
0
        //private static readonly ILog //_logger = LogManager.GetLogger(typeof(MapUtilities));

        #endregion

        #region MapBreak

        /// <summary>
        /// Maps the break.
        /// </summary>
        /// <param name="polyPoints">The poly points.</param>
        /// <param name="layerFilter">The layer filter.</param>
        /// <returns></returns>
        public static bool MapBreak(IList <GemsPoint2d> polyPoints, string layerFilter)
        {
            bool retval = false;

            //_logger.Debug("Start MapBreak");
            GemsPoint2d minPoint = CoordinateService.GetMinFromPolygon(polyPoints);
            GemsPoint2d maxPoint = CoordinateService.GetMaxFromPolygon(polyPoints);

            // This should return a selection set and check that it contains one or more objects
            // I would need to add a using to get the SelectionSet object in this class...?
            SelectionManager.GetSelectionSet(minPoint.X, minPoint.Y, maxPoint.X, maxPoint.Y, layerFilter, true);

            // The CMDDIA calls should reference SetSystemVariable
            StringBuilder acadCmd = new StringBuilder();

            acadCmd.Append("CMDDIA 0 ");
            acadCmd.Append("_MAPBREAK DEFINE ");
            foreach (GemsPoint2d onePoint in polyPoints)
            {
                acadCmd.Append(onePoint.X.ToString());
                acadCmd.Append(",");
                acadCmd.Append(onePoint.Y.ToString());
                acadCmd.Append("\r");
            }
            acadCmd.Append("\r");
            acadCmd.Append("N Y P  Y Y ");
            acadCmd.Append("CMDDIA 1 ");
            AcadUtilities.SendStringToExecute(acadCmd.ToString());
            retval = true;

            //_logger.Debug("End MapBreak");
            return(retval);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the state plane from lat long.
        /// </summary>
        /// <param name="manager">The manager.</param>
        /// <param name="source">The source.</param>
        /// <param name="dest">The dest.</param>
        /// <param name="statePlane">The state plane.</param>
        /// <returns></returns>
        public static bool GetStatePlaneFromLatLong(IDataManager manager, GemsPoint2d source, ref GemsPoint2d dest, ref string statePlane)
        {
            //_logger.Debug("Start GetStatePlaneFromLatLong");
            bool result = false;

            string statePlaneUsed = String.Empty;

            foreach (string sp in CoordinateService.GetStatePlanes())
            {
                try
                {
                    dest       = CoordinateService.TranslateWGS84ToStatePlane(manager, sp, source);
                    result     = true;
                    statePlane = sp;
                    break;
                }
                catch (System.Exception ex)
                {
                    //_logger.Error("Error in GetStatePlaneFromLatLong", ex);
                    throw;
                }
            }
            //_logger.Debug("End GetStatePlaneFromLatLong");
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Converts to lat long.
        /// </summary>
        /// <param name="dm">The dm.</param>
        /// <param name="sourcePoints">The source points.</param>
        /// <param name="acMapCsCode">The ac map cs code.</param>
        /// <returns></returns>
        public static IList <GemsPoint2d> ConvertToLatLong(IDataManager dm, IList <GemsPoint2d> sourcePoints, string acMapCsCode)
        {
            //_logger.Debug("Start ConvertToLatLong");
            IList <GemsPoint2d> list = new List <GemsPoint2d>();

            foreach (GemsPoint2d ptSource in sourcePoints)
            {
                GemsPoint2d pt = CoordinateService.TranslateStatePlaneToWGS84(dm, acMapCsCode, ptSource);
                list.Add(pt);
            }
            //_logger.Debug("Start ConvertToLatLong");
            return(list);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets the lat long to state plane.
        /// </summary>
        /// <param name="manager">The manager.</param>
        /// <param name="source">The source.</param>
        /// <param name="statePlane">The state plane.</param>
        /// <param name="dest">The dest.</param>
        /// <returns></returns>
        public static bool GetLatLongFromStatePlane(IDataManager manager, GemsPoint2d source, string statePlane, ref GemsPoint2d dest)
        {
            //_logger.Debug("Start GetLatLongFromStatePlane");
            bool result = false;

            try
            {
                dest   = CoordinateService.TranslateStatePlaneToWGS84(manager, statePlane, source);
                result = true;
            }
            catch (System.Exception ex)
            {
                //_logger.Error("Error in GetLatLongFromStatePlane", ex);
                throw;
            }
            //_logger.Debug("Start GetLatLongFromStatePlane");
            return(result);
        }