Exemplo n.º 1
0
        /**
         * returns the current SEE polygon from the OSDB
         */
        public IPolygon get_SEE()
        {
            SEEDAO dao = new SEEDAO(this.transactionManager.extension());

            return dao.find(this.TxId);
        }
Exemplo n.º 2
0
        /**
         *	Inits the current Transaction to the area specified in the SEE token. This
         *  method will import any additional features from the OSDB as required.
         *
         *	My be a lengthy Operation
         *
         *	Throws exceptions when:
         *		-	An IO Error occurs
         */
        public void Init(SEE token, int UTM)
        {
            ISpatialReference utmSR = this.transactionManager.getUTM(UTM);

            SEEDAO dao = new SEEDAO(this.transactionManager.extension());
            // throwing server faults...
            dao.insert(this, token, utmSR);

            // DO we need the extract call here?
            // data should all be previously extracted.

            extract(token.Shape,true);
        }
Exemplo n.º 3
0
        /**
         *	Expands the current Transaction to include the area specified in the SEE token. This
         *  method will import any additional features from the OSDB as required.
         *
         *	My be a lengthy Operation
         *
         *	Throws exceptions when:
         *		-	An IO Error occurs
         */
        public void Expand(SEE token)
        {
            // now handled by a REST request. No expanding stored directly by
            // the application to the database

            // CREATE A NEW TRANSACTION
            // COPY OLD TRANSACTIONAL DATA INTO NEW TRANSACTION
            // DELETE OLD TRANSACTION

            //// order is important here
            IPolygon previous = get_SEE();

            SEEDAO dao = new SEEDAO(this.transactionManager.extension());
            dao.update(this,token);

            if(previous == null)
            {
                // this path is only probably for some odd cases -- and during dev
                extract(token.Shape,true);
                return;
            }

            // buggy
            // http://forums.esri.com/Thread.asp?c=93&f=1170&t=88297#242834

            ITopologicalOperator2 op_original = (ITopologicalOperator2)previous;
            op_original.IsKnownSimple_2 = false;
            try
            {
                op_original.Simplify();
            }
            catch (Exception e)
            {
                Logger.Warn(e);
            }

            ITopologicalOperator2 op_new = (ITopologicalOperator2)token.Shape;
            op_new.IsKnownSimple_2 = false;
            try
            {
                op_new.Simplify();
            }
            catch (Exception e)
            {
                Logger.Warn(e);
            }

            if (previous.SpatialReference == null)
            {
                previous.SpatialReference = this.transactionManager.extension().FocusMap.SpatialReference;
            }

            if (token.Shape.SpatialReference == null)
            {
                token.Shape.SpatialReference = this.transactionManager.extension().FocusMap.SpatialReference;
            }

            token.Shape.Project(previous.SpatialReference);

            previous.SnapToSpatialReference();
            token.Shape.SnapToSpatialReference();

            IPolygon t = null;
            try
            {
                t = (IPolygon)(op_new.Difference((IPolygon)previous));
                if (op_new is ITopologicalOperator2)
                {
                    op_original = (ITopologicalOperator2)t;
                    try
                    {
                        op_new.Simplify();
                    }
                    catch (Exception e)
                    {
                        Logger.Warn(e);
                    }
                }
            }
            catch (Exception e)
            {
                Logger.Write(e);
                t = token.Shape; // less efficient
            }
            try
            {
                extract(t, false);
            }
            catch (HandledException he)
            {
                // rethrow -- probably connection related
                throw he;
            }
            catch (Exception e)
            {
                Logger.Write(e);
                // probably a bad shape resulting from subtraction above -- retry.

                extract(token.Shape, false); // less efficient
            }
        }