Exemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 13JUN2009  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * Tests whether the geometries of the two <code>Area</code> objects
         * are equal.
         * This method will return false if the argument is null.
         * @param   other  the <code>Area</code> to be compared to this
         *		<code>Area</code>
         * @return  <code>true</code> if the two geometries are equal;
         *		<code>false</code> otherwise.
         */
        public bool Equals(Area other)
        {
            // REMIND: A *much* simpler operation should be possible...
            // Should be able to do a curve-wise comparison since all Areas
            // should evaluate their curves in the same top-down order.
            if (other == this)
            {
                return(true);
            }
            if (other == null)
            {
                return(false);
            }
            ArrayList c = new AreaOp.XorOp().Calculate(_curves, other._curves);

            return(c.Count == 0);
        }
Exemplo n.º 2
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 13JUN2009  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * Sets the shape of this <code>Area</code> to be the combined area
         * of its current shape and the shape of the specified <code>Area</code>,
         * minus their intersection.
         * The resulting shape of this <code>Area</code> will include
         * only areas that were contained in either this <code>Area</code>
         * or in the specified <code>Area</code>, but not in both.
         * <pre>
         *     // Example:
         *     Area a1 = new Area([triangle 0,0 =&gt; 8,0 =&gt; 0,8]);
         *     Area a2 = new Area([triangle 0,0 =&gt; 8,0 =&gt; 8,8]);
         *     a1.exclusiveOr(a2);
         *
         *        a1(before)    xor        a2         =     a1(after)
         *
         *     ################     ################
         *     ##############         ##############     ##            ##
         *     ############             ############     ####        ####
         *     ##########                 ##########     ######    ######
         *     ########                     ########     ################
         *     ######                         ######     ######    ######
         *     ####                             ####     ####        ####
         *     ##                                 ##     ##            ##
         * </pre>
         * @param   rhs  the <code>Area</code> to be exclusive ORed with this
         *		<code>Area</code>.
         * @throws NullPointerException if <code>rhs</code> is null
         */
        public void ExclusiveOr(Area rhs)
        {
            _curves = new AreaOp.XorOp().Calculate(_curves, rhs._curves);
            InvalidateBounds();
        }
Exemplo n.º 3
0
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 13JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * Tests whether the geometries of the two <code>Area</code> objects
  * are equal.
  * This method will return false if the argument is null.
  * @param   other  the <code>Area</code> to be compared to this
  *		<code>Area</code>
  * @return  <code>true</code> if the two geometries are equal;
  *		<code>false</code> otherwise.
  */
 public bool Equals(Area other)
 {
     // REMIND: A *much* simpler operation should be possible...
     // Should be able to do a curve-wise comparison since all Areas
     // should evaluate their curves in the same top-down order.
     if (other == this)
     {
         return true;
     }
     if (other == null)
     {
         return false;
     }
     ArrayList c = new AreaOp.XorOp().Calculate(_curves, other._curves);
     return c.Count == 0;
 }