Example #1
0
        /// <summary>
        /// Constructor
        /// Always public with no return type with the name matching that of the class
        /// </summary>
        public ExamplePoint()
        {
            /*stating this.<property name> isn't necessary to access class properties
             * but I think it helps to understand that the variable is refering to #this# object*/

            //You'll see frequent use of the Guid class in my code
            //Serves the same purpose as the Guid.cal routine used in the field calculator in ArcMap
            //Guid.NewGuid() returns a Guid object, need to call ToString() in order to assign
            //to uniqueId which is a string
            this.uniqueId = Guid.NewGuid().ToString();

            //Initialize pointGeometry to a new instance of PointGeometry
            //using the constructor with no parameters
            this.pointGeometry = new PointGeometry();

            //Initialize mile post to 0 just so we don't have an
            //uninitialized variable, this could also have been set as a
            //default value up in the property declaration
            this.milePost = 0;
        }
Example #2
0
        /// <summary>
        /// Add a point on line 1 given the mile post
        /// </summary>
        /// <param name="milePost">Mile Post</param>
        /// <returns>success status true or false</returns>
        public bool AddPointByMilePost(double milePost)
        {
            if (milePost < 774 || milePost > 1090)
            {
                Console.WriteLine("Mile Post out of range for line 1");
                return false;
            }

            //Create a locator object for Line 1
            Enbridge.LinearReferencing.ContLineLocatorSQL loc = new Enbridge.LinearReferencing.ContLineLocatorSQL("{D4D4472B-FB1E-485B-A550-DCE76F63BC08}");

            //declare variables to hold return value and out parameters from getStnFromMP
            double meas, X, Y, Z, stationing;
            //run the locator
            stationing = loc.getStnFromMP(milePost, out meas, out X, out Y, out Z);

            //reassign the pointGeometry to a new instance of PointGeometry, created
            //using the constructor with parameters
            this.pointGeometry = new PointGeometry(X, Y, Z, stationing);

            //Set the geometryValuesAssigned flag to true
            this.geometryValuesAssigned = true;

            //set *this* object property milePost to the passed in parameter milePost
            this.milePost = milePost;

            return true;
        }