diff --git a/ChangeProjectReferencesMacro/SolutionReferences.vsmacros b/ChangeProjectReferencesMacro/SolutionReferences.vsmacros new file mode 100644 index 00000000..d20f04b1 Binary files /dev/null and b/ChangeProjectReferencesMacro/SolutionReferences.vsmacros differ diff --git a/Common.msbuild b/Common.msbuild index 3cee60d2..82fd6ed2 100644 --- a/Common.msbuild +++ b/Common.msbuild @@ -1,15 +1,15 @@  - false + True - false + True - false + True - false + True \ No newline at end of file diff --git a/ExternalReferences/Debug_Net20/GeoAPI.XML b/ExternalReferences/Debug_Net20/GeoAPI.XML index 47827c90..4fdbce62 100644 --- a/ExternalReferences/Debug_Net20/GeoAPI.XML +++ b/ExternalReferences/Debug_Net20/GeoAPI.XML @@ -81,6 +81,13 @@ to swap the bytes of. Byte order swapped . + + + Swaps the byte order of a . + + to swap the bytes of. + Byte order swapped . + Swaps the byte order of a (double precision IEEE 754) @@ -1478,6 +1485,32 @@ Gets the count of items in this node and all subnodes. + + + The inherent dimension of this geometric object, which must be + less than or equal to the coordinate dimension. + + + + + Returns if this geometry is the empty geometry. + If true, then this geometry represents the empty point set, ∅, for the + coordinate space. + + + + + Returns if the geometry has no anomalous geometric + points, such as self intersection or self tangency. The description of each + instantiable geometric class will include the specific conditions that cause + an instance of that class to be classified as not simple. + + + + + Gets the spatial reference system associated with the geometry. + + A set of quantities from which other quantities are calculated. @@ -1533,32 +1566,6 @@ Characters that are not whitespace, numbers, etc... - - - The inherent dimension of this geometric object, which must be - less than or equal to the coordinate dimension. - - - - - Returns if this geometry is the empty geometry. - If true, then this geometry represents the empty point set, ∅, for the - coordinate space. - - - - - Returns if the geometry has no anomalous geometric - points, such as self intersection or self tangency. The description of each - instantiable geometric class will include the specific conditions that cause - an instance of that class to be classified as not simple. - - - - - Gets the spatial reference system associated with the geometry. - - Gets the spatial reference system associated with the geometry. @@ -2085,6 +2092,21 @@ + + + Expands the given Envelope to include the coordinates in the sequence. + + + Allows implementing classes to optimize access to coordinate values. + + + The instance to expand. + + + An envelope which minimally encompasses all the coordinates in this + . + + Creates an array of all the @@ -2106,21 +2128,6 @@ An array of instances. - - - Expands the given Envelope to include the coordinates in the sequence. - - - Allows implementing classes to optimize access to coordinate values. - - - The instance to expand. - - - An envelope which minimally encompasses all the coordinates in this - . - - Determines which orientation of the @@ -3584,7 +3591,7 @@ A <Geometry Tagged Text> String (see the OpenGIS Simple Features Specification) - + Converts a Geometry to its Well-Known Text representation. @@ -3595,7 +3602,7 @@ Simple Features Specification). - + Converts a Geometry to <Geometry Tagged Text > format, then Appends it to the writer. @@ -3649,7 +3656,7 @@ The MultiPolygon to process The output stream writer to Append to. - + Converts a GeometryCollection to <GeometryCollection Tagged Text> format, then Appends it to the writer. @@ -3718,7 +3725,7 @@ The MultiPolygon to process. The output stream to Append to. - + Converts a GeometryCollection to <GeometryCollection Text > format, then Appends it to the writer. @@ -4585,7 +4592,7 @@ Creates an from an major radius, and inverse flattening. - + Name of ellipsoid. Semi major-axis. Inverse flattening. @@ -4596,32 +4603,13 @@ Creates an from an major radius, and inverse flattening. - + Name of ellipsoid. Semi major-axis. Inverse flattening. Linear unit. An instance with the given parameters. - - - Creates a coordinate system object from an XML String. - - XML representation for the spatial reference. - The resulting spatial reference object. - - - - Creates a spatial reference object given its Well-Known Text representation. - The output object may be either a - or - a . - - - The Well-Known Text representation for the spatial reference. - - The resulting spatial reference object. - Creates a , which @@ -4836,11 +4824,24 @@ Type of datum. Vertical datum. - + - Creates a geocentric coordinate system based on the WGS84 ellipsoid, - suitable for GPS measurements. + Creates a coordinate system object from an XML String. + XML representation for the spatial reference. + The resulting spatial reference object. + + + + Creates a spatial reference object given its Well-Known Text representation. + The output object may be either a + or + a . + + + The Well-Known Text representation for the spatial reference. + + The resulting spatial reference object. diff --git a/ExternalReferences/Debug_Net20/GeoAPI.dll b/ExternalReferences/Debug_Net20/GeoAPI.dll index 9724b859..0d9978a5 100644 Binary files a/ExternalReferences/Debug_Net20/GeoAPI.dll and b/ExternalReferences/Debug_Net20/GeoAPI.dll differ diff --git a/ExternalReferences/Debug_Net20/GeoAPI.pdb b/ExternalReferences/Debug_Net20/GeoAPI.pdb index 3eec0d88..98e107f5 100644 Binary files a/ExternalReferences/Debug_Net20/GeoAPI.pdb and b/ExternalReferences/Debug_Net20/GeoAPI.pdb differ diff --git a/ExternalReferences/Debug_Net20/NPack.XML b/ExternalReferences/Debug_Net20/NPack.XML index 7348f682..9e6e842b 100644 --- a/ExternalReferences/Debug_Net20/NPack.XML +++ b/ExternalReferences/Debug_Net20/NPack.XML @@ -883,6 +883,29 @@ Gets the multiplicative identity as a Single: 1F. + + + Every class that defines a * operation + like TProduct operator * (IMultipliable a, TFactor b) should consider + implementing this interface. + + + Type which multiplies the instance. + + Result type of the multiplication operation. + + Adapted from an article on lambda-computing.com: + http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs. + + + + + Returns the product of the Object and . + It must not modify the value of the Object. + + The factor to multiply by. + The product. + Provides an interface for a factorization of a matrix. @@ -984,6 +1007,43 @@ The index of the column of the element. The value of the element at the specified row and column. + + + Defines a type which has typical numerically computable properties. + + Input type of argument. + Result type of computation. + + + + Every class that defines a / operation + like T operator / (T a, T b) should consider + implementing this interface. + + + Type which divides the instance. + + Result type of the division operation. + + Adapted from an article on lambda-computing.com: + http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs. + + + + + Returns the quotient of the Object and . + It must not modify the value of the Object. + + The second operand. + The quotient. + + + + Sets the value of the IComputable value. + + Value used to set the IComputable. + The value of the IComputable converted from . + Creates a component-by-component copy of the vector. @@ -1590,7 +1650,7 @@ - + Construct a QR decomposition. @@ -1652,7 +1712,7 @@ - + Create a new LU decomposition. @@ -2275,49 +2335,6 @@ Thrown if is null. - - - Defines a type which has typical numerically computable properties. - - Input type of argument. - Result type of computation. - - - - Every class that defines a / operation - like T operator / (T a, T b) should consider - implementing this interface. - - - Type which divides the instance. - - Result type of the division operation. - - Adapted from an article on lambda-computing.com: - http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs. - - - - - Returns the quotient of the Object and . - It must not modify the value of the Object. - - The second operand. - The quotient. - - - - Computes the absolute value of the value. - - The absolute value of the IComputable value. - - - - Sets the value of the IComputable value. - - Value used to set the IComputable. - The value of the IComputable converted from . - Represents a column-major convention affine transform matrix. @@ -3255,7 +3272,7 @@ A submatrix with rows given by and columns through . - + Returns the transpose of the matrix. Returns a clone for Vector{T}, since vectors are storage agnostic. @@ -3295,7 +3312,7 @@ Thrown when accessed. - + Gets the format of the matrix, either row-major or column-major. @@ -4076,7 +4093,7 @@ The type of vector to store. The type of component in the vector. - + Creates a new for vectors of size , including space @@ -4092,7 +4109,7 @@ A factory used to create vectors of type . - + Creates a new with initial capacity for vectors of size diff --git a/ExternalReferences/Debug_Net20/NPack.dll b/ExternalReferences/Debug_Net20/NPack.dll index 22c47b28..a3648522 100644 Binary files a/ExternalReferences/Debug_Net20/NPack.dll and b/ExternalReferences/Debug_Net20/NPack.dll differ diff --git a/ExternalReferences/Debug_Net20/NPack.pdb b/ExternalReferences/Debug_Net20/NPack.pdb index 42bef66a..6ea958e2 100644 Binary files a/ExternalReferences/Debug_Net20/NPack.pdb and b/ExternalReferences/Debug_Net20/NPack.pdb differ diff --git a/ExternalReferences/Debug_Net35/GeoAPI.XML b/ExternalReferences/Debug_Net35/GeoAPI.XML index 47827c90..4fdbce62 100644 --- a/ExternalReferences/Debug_Net35/GeoAPI.XML +++ b/ExternalReferences/Debug_Net35/GeoAPI.XML @@ -81,6 +81,13 @@ to swap the bytes of. Byte order swapped . + + + Swaps the byte order of a . + + to swap the bytes of. + Byte order swapped . + Swaps the byte order of a (double precision IEEE 754) @@ -1478,6 +1485,32 @@ Gets the count of items in this node and all subnodes. + + + The inherent dimension of this geometric object, which must be + less than or equal to the coordinate dimension. + + + + + Returns if this geometry is the empty geometry. + If true, then this geometry represents the empty point set, ∅, for the + coordinate space. + + + + + Returns if the geometry has no anomalous geometric + points, such as self intersection or self tangency. The description of each + instantiable geometric class will include the specific conditions that cause + an instance of that class to be classified as not simple. + + + + + Gets the spatial reference system associated with the geometry. + + A set of quantities from which other quantities are calculated. @@ -1533,32 +1566,6 @@ Characters that are not whitespace, numbers, etc... - - - The inherent dimension of this geometric object, which must be - less than or equal to the coordinate dimension. - - - - - Returns if this geometry is the empty geometry. - If true, then this geometry represents the empty point set, ∅, for the - coordinate space. - - - - - Returns if the geometry has no anomalous geometric - points, such as self intersection or self tangency. The description of each - instantiable geometric class will include the specific conditions that cause - an instance of that class to be classified as not simple. - - - - - Gets the spatial reference system associated with the geometry. - - Gets the spatial reference system associated with the geometry. @@ -2085,6 +2092,21 @@ + + + Expands the given Envelope to include the coordinates in the sequence. + + + Allows implementing classes to optimize access to coordinate values. + + + The instance to expand. + + + An envelope which minimally encompasses all the coordinates in this + . + + Creates an array of all the @@ -2106,21 +2128,6 @@ An array of instances. - - - Expands the given Envelope to include the coordinates in the sequence. - - - Allows implementing classes to optimize access to coordinate values. - - - The instance to expand. - - - An envelope which minimally encompasses all the coordinates in this - . - - Determines which orientation of the @@ -3584,7 +3591,7 @@ A <Geometry Tagged Text> String (see the OpenGIS Simple Features Specification) - + Converts a Geometry to its Well-Known Text representation. @@ -3595,7 +3602,7 @@ Simple Features Specification). - + Converts a Geometry to <Geometry Tagged Text > format, then Appends it to the writer. @@ -3649,7 +3656,7 @@ The MultiPolygon to process The output stream writer to Append to. - + Converts a GeometryCollection to <GeometryCollection Tagged Text> format, then Appends it to the writer. @@ -3718,7 +3725,7 @@ The MultiPolygon to process. The output stream to Append to. - + Converts a GeometryCollection to <GeometryCollection Text > format, then Appends it to the writer. @@ -4585,7 +4592,7 @@ Creates an from an major radius, and inverse flattening. - + Name of ellipsoid. Semi major-axis. Inverse flattening. @@ -4596,32 +4603,13 @@ Creates an from an major radius, and inverse flattening. - + Name of ellipsoid. Semi major-axis. Inverse flattening. Linear unit. An instance with the given parameters. - - - Creates a coordinate system object from an XML String. - - XML representation for the spatial reference. - The resulting spatial reference object. - - - - Creates a spatial reference object given its Well-Known Text representation. - The output object may be either a - or - a . - - - The Well-Known Text representation for the spatial reference. - - The resulting spatial reference object. - Creates a , which @@ -4836,11 +4824,24 @@ Type of datum. Vertical datum. - + - Creates a geocentric coordinate system based on the WGS84 ellipsoid, - suitable for GPS measurements. + Creates a coordinate system object from an XML String. + XML representation for the spatial reference. + The resulting spatial reference object. + + + + Creates a spatial reference object given its Well-Known Text representation. + The output object may be either a + or + a . + + + The Well-Known Text representation for the spatial reference. + + The resulting spatial reference object. diff --git a/ExternalReferences/Debug_Net35/GeoAPI.dll b/ExternalReferences/Debug_Net35/GeoAPI.dll index 9d317e7c..a2e8d112 100644 Binary files a/ExternalReferences/Debug_Net35/GeoAPI.dll and b/ExternalReferences/Debug_Net35/GeoAPI.dll differ diff --git a/ExternalReferences/Debug_Net35/GeoAPI.pdb b/ExternalReferences/Debug_Net35/GeoAPI.pdb index 999e163a..40f612ef 100644 Binary files a/ExternalReferences/Debug_Net35/GeoAPI.pdb and b/ExternalReferences/Debug_Net35/GeoAPI.pdb differ diff --git a/ExternalReferences/Debug_Net35/NPack.XML b/ExternalReferences/Debug_Net35/NPack.XML index 7348f682..9e6e842b 100644 --- a/ExternalReferences/Debug_Net35/NPack.XML +++ b/ExternalReferences/Debug_Net35/NPack.XML @@ -883,6 +883,29 @@ Gets the multiplicative identity as a Single: 1F. + + + Every class that defines a * operation + like TProduct operator * (IMultipliable a, TFactor b) should consider + implementing this interface. + + + Type which multiplies the instance. + + Result type of the multiplication operation. + + Adapted from an article on lambda-computing.com: + http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs. + + + + + Returns the product of the Object and . + It must not modify the value of the Object. + + The factor to multiply by. + The product. + Provides an interface for a factorization of a matrix. @@ -984,6 +1007,43 @@ The index of the column of the element. The value of the element at the specified row and column. + + + Defines a type which has typical numerically computable properties. + + Input type of argument. + Result type of computation. + + + + Every class that defines a / operation + like T operator / (T a, T b) should consider + implementing this interface. + + + Type which divides the instance. + + Result type of the division operation. + + Adapted from an article on lambda-computing.com: + http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs. + + + + + Returns the quotient of the Object and . + It must not modify the value of the Object. + + The second operand. + The quotient. + + + + Sets the value of the IComputable value. + + Value used to set the IComputable. + The value of the IComputable converted from . + Creates a component-by-component copy of the vector. @@ -1590,7 +1650,7 @@ - + Construct a QR decomposition. @@ -1652,7 +1712,7 @@ - + Create a new LU decomposition. @@ -2275,49 +2335,6 @@ Thrown if is null. - - - Defines a type which has typical numerically computable properties. - - Input type of argument. - Result type of computation. - - - - Every class that defines a / operation - like T operator / (T a, T b) should consider - implementing this interface. - - - Type which divides the instance. - - Result type of the division operation. - - Adapted from an article on lambda-computing.com: - http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs. - - - - - Returns the quotient of the Object and . - It must not modify the value of the Object. - - The second operand. - The quotient. - - - - Computes the absolute value of the value. - - The absolute value of the IComputable value. - - - - Sets the value of the IComputable value. - - Value used to set the IComputable. - The value of the IComputable converted from . - Represents a column-major convention affine transform matrix. @@ -3255,7 +3272,7 @@ A submatrix with rows given by and columns through . - + Returns the transpose of the matrix. Returns a clone for Vector{T}, since vectors are storage agnostic. @@ -3295,7 +3312,7 @@ Thrown when accessed. - + Gets the format of the matrix, either row-major or column-major. @@ -4076,7 +4093,7 @@ The type of vector to store. The type of component in the vector. - + Creates a new for vectors of size , including space @@ -4092,7 +4109,7 @@ A factory used to create vectors of type . - + Creates a new with initial capacity for vectors of size diff --git a/ExternalReferences/Debug_Net35/NPack.dll b/ExternalReferences/Debug_Net35/NPack.dll index 22c47b28..efd82ba9 100644 Binary files a/ExternalReferences/Debug_Net35/NPack.dll and b/ExternalReferences/Debug_Net35/NPack.dll differ diff --git a/ExternalReferences/Debug_Net35/NPack.pdb b/ExternalReferences/Debug_Net35/NPack.pdb index 42bef66a..bfe46ce7 100644 Binary files a/ExternalReferences/Debug_Net35/NPack.pdb and b/ExternalReferences/Debug_Net35/NPack.pdb differ diff --git a/ExternalReferences/Release_Net20/GeoAPI.XML b/ExternalReferences/Release_Net20/GeoAPI.XML index 47827c90..4fdbce62 100644 --- a/ExternalReferences/Release_Net20/GeoAPI.XML +++ b/ExternalReferences/Release_Net20/GeoAPI.XML @@ -81,6 +81,13 @@ to swap the bytes of. Byte order swapped . + + + Swaps the byte order of a . + + to swap the bytes of. + Byte order swapped . + Swaps the byte order of a (double precision IEEE 754) @@ -1478,6 +1485,32 @@ Gets the count of items in this node and all subnodes. + + + The inherent dimension of this geometric object, which must be + less than or equal to the coordinate dimension. + + + + + Returns if this geometry is the empty geometry. + If true, then this geometry represents the empty point set, ∅, for the + coordinate space. + + + + + Returns if the geometry has no anomalous geometric + points, such as self intersection or self tangency. The description of each + instantiable geometric class will include the specific conditions that cause + an instance of that class to be classified as not simple. + + + + + Gets the spatial reference system associated with the geometry. + + A set of quantities from which other quantities are calculated. @@ -1533,32 +1566,6 @@ Characters that are not whitespace, numbers, etc... - - - The inherent dimension of this geometric object, which must be - less than or equal to the coordinate dimension. - - - - - Returns if this geometry is the empty geometry. - If true, then this geometry represents the empty point set, ∅, for the - coordinate space. - - - - - Returns if the geometry has no anomalous geometric - points, such as self intersection or self tangency. The description of each - instantiable geometric class will include the specific conditions that cause - an instance of that class to be classified as not simple. - - - - - Gets the spatial reference system associated with the geometry. - - Gets the spatial reference system associated with the geometry. @@ -2085,6 +2092,21 @@ + + + Expands the given Envelope to include the coordinates in the sequence. + + + Allows implementing classes to optimize access to coordinate values. + + + The instance to expand. + + + An envelope which minimally encompasses all the coordinates in this + . + + Creates an array of all the @@ -2106,21 +2128,6 @@ An array of instances. - - - Expands the given Envelope to include the coordinates in the sequence. - - - Allows implementing classes to optimize access to coordinate values. - - - The instance to expand. - - - An envelope which minimally encompasses all the coordinates in this - . - - Determines which orientation of the @@ -3584,7 +3591,7 @@ A <Geometry Tagged Text> String (see the OpenGIS Simple Features Specification) - + Converts a Geometry to its Well-Known Text representation. @@ -3595,7 +3602,7 @@ Simple Features Specification). - + Converts a Geometry to <Geometry Tagged Text > format, then Appends it to the writer. @@ -3649,7 +3656,7 @@ The MultiPolygon to process The output stream writer to Append to. - + Converts a GeometryCollection to <GeometryCollection Tagged Text> format, then Appends it to the writer. @@ -3718,7 +3725,7 @@ The MultiPolygon to process. The output stream to Append to. - + Converts a GeometryCollection to <GeometryCollection Text > format, then Appends it to the writer. @@ -4585,7 +4592,7 @@ Creates an from an major radius, and inverse flattening. - + Name of ellipsoid. Semi major-axis. Inverse flattening. @@ -4596,32 +4603,13 @@ Creates an from an major radius, and inverse flattening. - + Name of ellipsoid. Semi major-axis. Inverse flattening. Linear unit. An instance with the given parameters. - - - Creates a coordinate system object from an XML String. - - XML representation for the spatial reference. - The resulting spatial reference object. - - - - Creates a spatial reference object given its Well-Known Text representation. - The output object may be either a - or - a . - - - The Well-Known Text representation for the spatial reference. - - The resulting spatial reference object. - Creates a , which @@ -4836,11 +4824,24 @@ Type of datum. Vertical datum. - + - Creates a geocentric coordinate system based on the WGS84 ellipsoid, - suitable for GPS measurements. + Creates a coordinate system object from an XML String. + XML representation for the spatial reference. + The resulting spatial reference object. + + + + Creates a spatial reference object given its Well-Known Text representation. + The output object may be either a + or + a . + + + The Well-Known Text representation for the spatial reference. + + The resulting spatial reference object. diff --git a/ExternalReferences/Release_Net20/GeoAPI.dll b/ExternalReferences/Release_Net20/GeoAPI.dll index 9885fafd..98638c09 100644 Binary files a/ExternalReferences/Release_Net20/GeoAPI.dll and b/ExternalReferences/Release_Net20/GeoAPI.dll differ diff --git a/ExternalReferences/Release_Net20/GeoAPI.pdb b/ExternalReferences/Release_Net20/GeoAPI.pdb index f055825e..242c458a 100644 Binary files a/ExternalReferences/Release_Net20/GeoAPI.pdb and b/ExternalReferences/Release_Net20/GeoAPI.pdb differ diff --git a/ExternalReferences/Release_Net20/NPack.XML b/ExternalReferences/Release_Net20/NPack.XML index 7348f682..9e6e842b 100644 --- a/ExternalReferences/Release_Net20/NPack.XML +++ b/ExternalReferences/Release_Net20/NPack.XML @@ -883,6 +883,29 @@ Gets the multiplicative identity as a Single: 1F. + + + Every class that defines a * operation + like TProduct operator * (IMultipliable a, TFactor b) should consider + implementing this interface. + + + Type which multiplies the instance. + + Result type of the multiplication operation. + + Adapted from an article on lambda-computing.com: + http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs. + + + + + Returns the product of the Object and . + It must not modify the value of the Object. + + The factor to multiply by. + The product. + Provides an interface for a factorization of a matrix. @@ -984,6 +1007,43 @@ The index of the column of the element. The value of the element at the specified row and column. + + + Defines a type which has typical numerically computable properties. + + Input type of argument. + Result type of computation. + + + + Every class that defines a / operation + like T operator / (T a, T b) should consider + implementing this interface. + + + Type which divides the instance. + + Result type of the division operation. + + Adapted from an article on lambda-computing.com: + http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs. + + + + + Returns the quotient of the Object and . + It must not modify the value of the Object. + + The second operand. + The quotient. + + + + Sets the value of the IComputable value. + + Value used to set the IComputable. + The value of the IComputable converted from . + Creates a component-by-component copy of the vector. @@ -1590,7 +1650,7 @@ - + Construct a QR decomposition. @@ -1652,7 +1712,7 @@ - + Create a new LU decomposition. @@ -2275,49 +2335,6 @@ Thrown if is null. - - - Defines a type which has typical numerically computable properties. - - Input type of argument. - Result type of computation. - - - - Every class that defines a / operation - like T operator / (T a, T b) should consider - implementing this interface. - - - Type which divides the instance. - - Result type of the division operation. - - Adapted from an article on lambda-computing.com: - http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs. - - - - - Returns the quotient of the Object and . - It must not modify the value of the Object. - - The second operand. - The quotient. - - - - Computes the absolute value of the value. - - The absolute value of the IComputable value. - - - - Sets the value of the IComputable value. - - Value used to set the IComputable. - The value of the IComputable converted from . - Represents a column-major convention affine transform matrix. @@ -3255,7 +3272,7 @@ A submatrix with rows given by and columns through . - + Returns the transpose of the matrix. Returns a clone for Vector{T}, since vectors are storage agnostic. @@ -3295,7 +3312,7 @@ Thrown when accessed. - + Gets the format of the matrix, either row-major or column-major. @@ -4076,7 +4093,7 @@ The type of vector to store. The type of component in the vector. - + Creates a new for vectors of size , including space @@ -4092,7 +4109,7 @@ A factory used to create vectors of type . - + Creates a new with initial capacity for vectors of size diff --git a/ExternalReferences/Release_Net20/NPack.dll b/ExternalReferences/Release_Net20/NPack.dll index 22c47b28..50ffb73e 100644 Binary files a/ExternalReferences/Release_Net20/NPack.dll and b/ExternalReferences/Release_Net20/NPack.dll differ diff --git a/ExternalReferences/Release_Net20/NPack.pdb b/ExternalReferences/Release_Net20/NPack.pdb index 42bef66a..84abe715 100644 Binary files a/ExternalReferences/Release_Net20/NPack.pdb and b/ExternalReferences/Release_Net20/NPack.pdb differ diff --git a/ExternalReferences/Release_Net35/GeoAPI.XML b/ExternalReferences/Release_Net35/GeoAPI.XML index 47827c90..4fdbce62 100644 --- a/ExternalReferences/Release_Net35/GeoAPI.XML +++ b/ExternalReferences/Release_Net35/GeoAPI.XML @@ -81,6 +81,13 @@ to swap the bytes of. Byte order swapped . + + + Swaps the byte order of a . + + to swap the bytes of. + Byte order swapped . + Swaps the byte order of a (double precision IEEE 754) @@ -1478,6 +1485,32 @@ Gets the count of items in this node and all subnodes. + + + The inherent dimension of this geometric object, which must be + less than or equal to the coordinate dimension. + + + + + Returns if this geometry is the empty geometry. + If true, then this geometry represents the empty point set, ∅, for the + coordinate space. + + + + + Returns if the geometry has no anomalous geometric + points, such as self intersection or self tangency. The description of each + instantiable geometric class will include the specific conditions that cause + an instance of that class to be classified as not simple. + + + + + Gets the spatial reference system associated with the geometry. + + A set of quantities from which other quantities are calculated. @@ -1533,32 +1566,6 @@ Characters that are not whitespace, numbers, etc... - - - The inherent dimension of this geometric object, which must be - less than or equal to the coordinate dimension. - - - - - Returns if this geometry is the empty geometry. - If true, then this geometry represents the empty point set, ∅, for the - coordinate space. - - - - - Returns if the geometry has no anomalous geometric - points, such as self intersection or self tangency. The description of each - instantiable geometric class will include the specific conditions that cause - an instance of that class to be classified as not simple. - - - - - Gets the spatial reference system associated with the geometry. - - Gets the spatial reference system associated with the geometry. @@ -2085,6 +2092,21 @@ + + + Expands the given Envelope to include the coordinates in the sequence. + + + Allows implementing classes to optimize access to coordinate values. + + + The instance to expand. + + + An envelope which minimally encompasses all the coordinates in this + . + + Creates an array of all the @@ -2106,21 +2128,6 @@ An array of instances. - - - Expands the given Envelope to include the coordinates in the sequence. - - - Allows implementing classes to optimize access to coordinate values. - - - The instance to expand. - - - An envelope which minimally encompasses all the coordinates in this - . - - Determines which orientation of the @@ -3584,7 +3591,7 @@ A <Geometry Tagged Text> String (see the OpenGIS Simple Features Specification) - + Converts a Geometry to its Well-Known Text representation. @@ -3595,7 +3602,7 @@ Simple Features Specification). - + Converts a Geometry to <Geometry Tagged Text > format, then Appends it to the writer. @@ -3649,7 +3656,7 @@ The MultiPolygon to process The output stream writer to Append to. - + Converts a GeometryCollection to <GeometryCollection Tagged Text> format, then Appends it to the writer. @@ -3718,7 +3725,7 @@ The MultiPolygon to process. The output stream to Append to. - + Converts a GeometryCollection to <GeometryCollection Text > format, then Appends it to the writer. @@ -4585,7 +4592,7 @@ Creates an from an major radius, and inverse flattening. - + Name of ellipsoid. Semi major-axis. Inverse flattening. @@ -4596,32 +4603,13 @@ Creates an from an major radius, and inverse flattening. - + Name of ellipsoid. Semi major-axis. Inverse flattening. Linear unit. An instance with the given parameters. - - - Creates a coordinate system object from an XML String. - - XML representation for the spatial reference. - The resulting spatial reference object. - - - - Creates a spatial reference object given its Well-Known Text representation. - The output object may be either a - or - a . - - - The Well-Known Text representation for the spatial reference. - - The resulting spatial reference object. - Creates a , which @@ -4836,11 +4824,24 @@ Type of datum. Vertical datum. - + - Creates a geocentric coordinate system based on the WGS84 ellipsoid, - suitable for GPS measurements. + Creates a coordinate system object from an XML String. + XML representation for the spatial reference. + The resulting spatial reference object. + + + + Creates a spatial reference object given its Well-Known Text representation. + The output object may be either a + or + a . + + + The Well-Known Text representation for the spatial reference. + + The resulting spatial reference object. diff --git a/ExternalReferences/Release_Net35/GeoAPI.dll b/ExternalReferences/Release_Net35/GeoAPI.dll index 04a1c354..d5be2928 100644 Binary files a/ExternalReferences/Release_Net35/GeoAPI.dll and b/ExternalReferences/Release_Net35/GeoAPI.dll differ diff --git a/ExternalReferences/Release_Net35/GeoAPI.pdb b/ExternalReferences/Release_Net35/GeoAPI.pdb index 9b63342d..97b650cd 100644 Binary files a/ExternalReferences/Release_Net35/GeoAPI.pdb and b/ExternalReferences/Release_Net35/GeoAPI.pdb differ diff --git a/ExternalReferences/Release_Net35/NPack.XML b/ExternalReferences/Release_Net35/NPack.XML index 7348f682..9e6e842b 100644 --- a/ExternalReferences/Release_Net35/NPack.XML +++ b/ExternalReferences/Release_Net35/NPack.XML @@ -883,6 +883,29 @@ Gets the multiplicative identity as a Single: 1F. + + + Every class that defines a * operation + like TProduct operator * (IMultipliable a, TFactor b) should consider + implementing this interface. + + + Type which multiplies the instance. + + Result type of the multiplication operation. + + Adapted from an article on lambda-computing.com: + http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs. + + + + + Returns the product of the Object and . + It must not modify the value of the Object. + + The factor to multiply by. + The product. + Provides an interface for a factorization of a matrix. @@ -984,6 +1007,43 @@ The index of the column of the element. The value of the element at the specified row and column. + + + Defines a type which has typical numerically computable properties. + + Input type of argument. + Result type of computation. + + + + Every class that defines a / operation + like T operator / (T a, T b) should consider + implementing this interface. + + + Type which divides the instance. + + Result type of the division operation. + + Adapted from an article on lambda-computing.com: + http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs. + + + + + Returns the quotient of the Object and . + It must not modify the value of the Object. + + The second operand. + The quotient. + + + + Sets the value of the IComputable value. + + Value used to set the IComputable. + The value of the IComputable converted from . + Creates a component-by-component copy of the vector. @@ -1590,7 +1650,7 @@ - + Construct a QR decomposition. @@ -1652,7 +1712,7 @@ - + Create a new LU decomposition. @@ -2275,49 +2335,6 @@ Thrown if is null. - - - Defines a type which has typical numerically computable properties. - - Input type of argument. - Result type of computation. - - - - Every class that defines a / operation - like T operator / (T a, T b) should consider - implementing this interface. - - - Type which divides the instance. - - Result type of the division operation. - - Adapted from an article on lambda-computing.com: - http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs. - - - - - Returns the quotient of the Object and . - It must not modify the value of the Object. - - The second operand. - The quotient. - - - - Computes the absolute value of the value. - - The absolute value of the IComputable value. - - - - Sets the value of the IComputable value. - - Value used to set the IComputable. - The value of the IComputable converted from . - Represents a column-major convention affine transform matrix. @@ -3255,7 +3272,7 @@ A submatrix with rows given by and columns through . - + Returns the transpose of the matrix. Returns a clone for Vector{T}, since vectors are storage agnostic. @@ -3295,7 +3312,7 @@ Thrown when accessed. - + Gets the format of the matrix, either row-major or column-major. @@ -4076,7 +4093,7 @@ The type of vector to store. The type of component in the vector. - + Creates a new for vectors of size , including space @@ -4092,7 +4109,7 @@ A factory used to create vectors of type . - + Creates a new with initial capacity for vectors of size diff --git a/ExternalReferences/Release_Net35/NPack.dll b/ExternalReferences/Release_Net35/NPack.dll index 22c47b28..a0e03a9c 100644 Binary files a/ExternalReferences/Release_Net35/NPack.dll and b/ExternalReferences/Release_Net35/NPack.dll differ diff --git a/ExternalReferences/Release_Net35/NPack.pdb b/ExternalReferences/Release_Net35/NPack.pdb index 42bef66a..39932a89 100644 Binary files a/ExternalReferences/Release_Net35/NPack.pdb and b/ExternalReferences/Release_Net35/NPack.pdb differ diff --git a/Proj.Net/ProjNet/ProjNet.csproj b/Proj.Net/ProjNet/ProjNet.csproj index d4e195de..96f02fd7 100644 --- a/Proj.Net/ProjNet/ProjNet.csproj +++ b/Proj.Net/ProjNet/ProjNet.csproj @@ -104,11 +104,11 @@ False - ..\ExternalReferences\$(Configuration)\NPack.dll + ..\..\ExternalReferences\$(Configuration)\NPack.dll False - ..\ExternalReferences\$(Configuration)\GeoAPI.dll + ..\..\ExternalReferences\$(Configuration)\GeoAPI.dll @@ -116,7 +116,7 @@ False - ..\ExternalReferences\$(Configuration)\NPack.dll + ..\..\ExternalReferences\$(Configuration)\NPack.dll @@ -140,7 +140,6 @@ - - \ No newline at end of file + diff --git a/SharpMap.Rendering.Gdi.Tests/BasicGeometryRenderer2DWithGdiVectorRenderer.cs b/SharpMap.Rendering.Gdi.Tests/BasicGeometryRenderer2DWithGdiVectorRenderer.cs index 24cfa525..051cbeea 100644 --- a/SharpMap.Rendering.Gdi.Tests/BasicGeometryRenderer2DWithGdiVectorRenderer.cs +++ b/SharpMap.Rendering.Gdi.Tests/BasicGeometryRenderer2DWithGdiVectorRenderer.cs @@ -9,6 +9,7 @@ using SharpMap.Data; using SharpMap.Data.Providers.FeatureProvider; using SharpMap.Rendering.Rendering2D; +using SharpMap.SimpleGeometries; using SharpMap.Tests; namespace SharpMap.Rendering.Gdi.Tests @@ -17,6 +18,7 @@ namespace SharpMap.Rendering.Gdi.Tests public class BasicGeometryRenderer2DWithGdiVectorRenderer { private static readonly Single _e = 0.0001f; + private IGeometryFactory _geoFactory = new GeometryFactory(); [Test] public void CreatingBasicGeometryRenderer2DWithGdiVectorRendererSucceeds() @@ -36,7 +38,7 @@ public void RenderingPolygonsWithGdiVectorRendererProducesCorrectGdiPaths() BasicGeometryRenderer2D geometryRenderer = new BasicGeometryRenderer2D(vectorRenderer); - FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(_geoFactory); foreach (IFeatureDataRecord record in provider.ExecuteIntersectionQuery(provider.GetExtents())) { @@ -141,7 +143,7 @@ public void RenderingLinesWithGdiVectorRendererProducesCorrectGdiPaths() BasicGeometryRenderer2D geometryRenderer = new BasicGeometryRenderer2D(vectorRenderer); - FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(_geoFactory); foreach (IFeatureDataRecord record in provider.ExecuteIntersectionQuery(provider.GetExtents())) { @@ -203,7 +205,7 @@ public void RenderingPointsGeometriesWithGdiVectorRendererProducesCorrectGdiBitm BasicGeometryRenderer2D geometryRenderer = new BasicGeometryRenderer2D(vectorRenderer); - FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(_geoFactory); foreach (IFeatureDataRecord record in provider.ExecuteIntersectionQuery(provider.GetExtents())) { diff --git a/SharpMap.Rendering.Gdi.Tests/SharpMap.Rendering.Gdi.Tests.csproj b/SharpMap.Rendering.Gdi.Tests/SharpMap.Rendering.Gdi.Tests.csproj index fce5d4f7..eb713a64 100644 --- a/SharpMap.Rendering.Gdi.Tests/SharpMap.Rendering.Gdi.Tests.csproj +++ b/SharpMap.Rendering.Gdi.Tests/SharpMap.Rendering.Gdi.Tests.csproj @@ -86,6 +86,10 @@ {EC29E6E4-CE31-4989-BAA7-0125F1F8910A} SharpMap.Rendering.Gdi + + {7F258589-6452-4B7B-8884-8965A42C1D9E} + SharpMap.SimpleGeometries + {C83777FC-AABB-47D9-911F-D76255D4D541} SharpMap diff --git a/SharpMap.Rendering.Gdi/GdiRenderObject.cs b/SharpMap.Rendering.Gdi/GdiRenderObject.cs index a8d0148b..33de4b85 100644 --- a/SharpMap.Rendering.Gdi/GdiRenderObject.cs +++ b/SharpMap.Rendering.Gdi/GdiRenderObject.cs @@ -19,6 +19,7 @@ using System.Drawing; using System.Drawing.Drawing2D; using GdiColorMatrix = System.Drawing.Imaging.ColorMatrix; +using SharpMap.Layers; namespace SharpMap.Rendering.Gdi { @@ -64,7 +65,7 @@ public GdiRenderObject(GraphicsPath path, Brush fill, Brush highlightFill, Brush Pen line, Pen highlightLine, Pen selectLine, Pen outline, Pen highlightOutline, Pen selectOutline) { - _state = RenderState.Normal; + _state = RenderState.Normal; GdiPath = path; Fill = fill; HighlightFill = highlightFill; @@ -94,7 +95,7 @@ public GdiRenderObject(GraphicsPath path, Brush fill, Brush highlightFill, Brush /// The color transform applied to the symbol before drawing. public GdiRenderObject(Bitmap image, RectangleF imageBounds, Matrix transform, GdiColorMatrix colorTransform) { - _state = RenderState.Normal; + _state = RenderState.Normal; Image = image; Bounds = imageBounds; AffineTransform = transform; @@ -142,7 +143,7 @@ public GdiRenderObject(Bitmap image, RectangleF imageBounds, Matrix transform, G public GdiRenderObject(String text, Font font, RectangleF bounds, Brush fill, Brush highlightFill, Brush selectFill, Pen outline, Pen highlightOutline, Pen selectOutline) { - _state = RenderState.Normal; + _state = RenderState.Normal; GdiPath = null; Image = null; @@ -249,10 +250,10 @@ public GdiRenderObject(String text, Font font, RectangleF bounds, Brush fill, Br /// /// Gets or sets the render object state of visual appearance. /// - public RenderState State - { - get { return _state; } - set { _state = value; } - } - } + public RenderState State + { + get { return _state; } + set { _state = value; } + } + } } \ No newline at end of file diff --git a/SharpMap.Rendering.Gdi/SharpMap.Rendering.Gdi.csproj b/SharpMap.Rendering.Gdi/SharpMap.Rendering.Gdi.csproj index 2a36f684..28a138a1 100644 --- a/SharpMap.Rendering.Gdi/SharpMap.Rendering.Gdi.csproj +++ b/SharpMap.Rendering.Gdi/SharpMap.Rendering.Gdi.csproj @@ -65,8 +65,7 @@ - + @@ -96,4 +95,4 @@ --> - \ No newline at end of file + diff --git a/SharpMap.SimpleGeometries/Extents.cs b/SharpMap.SimpleGeometries/Extents.cs index 9d7e8549..643eeef9 100644 --- a/SharpMap.SimpleGeometries/Extents.cs +++ b/SharpMap.SimpleGeometries/Extents.cs @@ -1765,6 +1765,11 @@ public void Translate(params Double[] vector) throw new NotImplementedException(); } + public void TranslateRelative(params Double[] vector) + { + throw new NotImplementedException(); + } + public IExtents Union(IExtents box) { throw new NotImplementedException(); diff --git a/SharpMap.SimpleGeometries/GeometryFactory.cs b/SharpMap.SimpleGeometries/GeometryFactory.cs new file mode 100644 index 00000000..877fdeca --- /dev/null +++ b/SharpMap.SimpleGeometries/GeometryFactory.cs @@ -0,0 +1,262 @@ +using System; +using System.Collections.Generic; +using GeoAPI.Coordinates; +using GeoAPI.CoordinateSystems; +using GeoAPI.Geometries; + +namespace SharpMap.SimpleGeometries +{ + public class GeometryFactory : IGeometryFactory + { + #region IGeometryFactory Members + + public ICoordinateFactory CoordinateFactory + { + get { throw new NotImplementedException(); } + } + + public ICoordinateSequenceFactory CoordinateSequenceFactory + { + get { throw new NotImplementedException(); } + } + + public int? Srid + { + get { throw new NotImplementedException(); } + } + + public ICoordinateSystem SpatialReference + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + + public IPrecisionModel PrecisionModel + { + get { throw new NotImplementedException(); } + } + + public IGeometry BuildGeometry(IEnumerable geometryList) + { + throw new NotImplementedException(); + } + + public IExtents CreateExtents() + { + throw new NotImplementedException(); + } + + public IExtents CreateExtents(ICoordinate min, ICoordinate max) + { + throw new NotImplementedException(); + } + + public IGeometry CreateGeometry(IGeometry g) + { + throw new NotImplementedException(); + } + + public IGeometry CreateGeometry(ICoordinateSequence coordinates, OgcGeometryType type) + { + throw new NotImplementedException(); + } + + public IPoint CreatePoint() + { + throw new NotImplementedException(); + } + + public IPoint CreatePoint(ICoordinate coordinate) + { + throw new NotImplementedException(); + } + + public IPoint CreatePoint(ICoordinateSequence coordinates) + { + throw new NotImplementedException(); + } + + public IPoint2D CreatePoint2D() + { + throw new NotImplementedException(); + } + + public IPoint2D CreatePoint2D(double x, double y) + { + throw new NotImplementedException(); + } + + public IPoint2DM CreatePoint2DM(double x, double y, double m) + { + throw new NotImplementedException(); + } + + public IPoint3D CreatePoint3D() + { + throw new NotImplementedException(); + } + + public IPoint3D CreatePoint3D(double x, double y, double z) + { + throw new NotImplementedException(); + } + + public IPoint3D CreatePoint3D(IPoint2D point2D, double z) + { + throw new NotImplementedException(); + } + + public IPoint3DM CreatePoint3DM(double x, double y, double z, double m) + { + throw new NotImplementedException(); + } + + public ILineString CreateLineString() + { + throw new NotImplementedException(); + } + + public ILineString CreateLineString(IEnumerable coordinates) + { + throw new NotImplementedException(); + } + + public ILineString CreateLineString(ICoordinateSequence coordinates) + { + throw new NotImplementedException(); + } + + public ILinearRing CreateLinearRing() + { + throw new NotImplementedException(); + } + + public ILinearRing CreateLinearRing(IEnumerable coordinates) + { + throw new NotImplementedException(); + } + + public ILinearRing CreateLinearRing(ICoordinateSequence coordinates) + { + throw new NotImplementedException(); + } + + public IPolygon CreatePolygon() + { + throw new NotImplementedException(); + } + + public IPolygon CreatePolygon(IEnumerable shell) + { + throw new NotImplementedException(); + } + + public IPolygon CreatePolygon(ILinearRing shell) + { + throw new NotImplementedException(); + } + + public IPolygon CreatePolygon(ILinearRing shell, IEnumerable holes) + { + throw new NotImplementedException(); + } + + public IMultiPoint CreateMultiPoint() + { + throw new NotImplementedException(); + } + + public IMultiPoint CreateMultiPoint(IEnumerable coordinates) + { + throw new NotImplementedException(); + } + + public IMultiPoint CreateMultiPoint(IEnumerable point) + { + throw new NotImplementedException(); + } + + public IMultiPoint CreateMultiPoint(ICoordinateSequence coordinates) + { + throw new NotImplementedException(); + } + + public IMultiLineString CreateMultiLineString() + { + throw new NotImplementedException(); + } + + public IMultiLineString CreateMultiLineString(IEnumerable lineStrings) + { + throw new NotImplementedException(); + } + + public IMultiPolygon CreateMultiPolygon() + { + throw new NotImplementedException(); + } + + public IMultiPolygon CreateMultiPolygon(IEnumerable polygons) + { + throw new NotImplementedException(); + } + + public IGeometryCollection CreateGeometryCollection() + { + throw new NotImplementedException(); + } + + public IGeometryCollection CreateGeometryCollection(IEnumerable geometries) + { + throw new NotImplementedException(); + } + + public IGeometry ToGeometry(IExtents envelopeInternal) + { + throw new NotImplementedException(); + } + + public IExtents CreateExtents(IExtents first, IExtents second) + { + throw new NotImplementedException(); + } + + public IExtents CreateExtents(IExtents first, IExtents second, IExtents third) + { + throw new NotImplementedException(); + } + + public IExtents CreateExtents(params IExtents[] extents) + { + throw new NotImplementedException(); + } + + public IExtents2D CreateExtents2D(double left, double bottom, double right, double top) + { + throw new NotImplementedException(); + } + + public IExtents2D CreateExtents2D(GeoAPI.DataStructures.Pair lowerLeft, GeoAPI.DataStructures.Pair upperRight) + { + throw new NotImplementedException(); + } + + public IExtents3D CreateExtents3D(double left, double bottom, double front, double right, double top, double back) + { + throw new NotImplementedException(); + } + + public IExtents3D CreateExtents3D(GeoAPI.DataStructures.Triple lowerLeft, GeoAPI.DataStructures.Triple upperRight) + { + throw new NotImplementedException(); + } + + #endregion + } +} \ No newline at end of file diff --git a/SharpMap.SimpleGeometries/Point.cs b/SharpMap.SimpleGeometries/Point.cs index 3795aac3..dd2f934c 100644 --- a/SharpMap.SimpleGeometries/Point.cs +++ b/SharpMap.SimpleGeometries/Point.cs @@ -35,6 +35,7 @@ public class Point : Geometry, IPoint, IComparable, IVector - ///// Returns the number of ordinates for this point - ///// - //public virtual Int32 NumOrdinates - //{ - // get { return 2; } - //} - - ///// - ///// Transforms the point to image coordinates, based on the map - ///// - ///// Map to base coordinates on - ///// point in image coordinates - //public System.Drawing.PointF TransformToImage(Map map) - //{ - // return SharpMap.Utilities.Transform.WorldToMap(this, map); - //} + #region IPoint Members + + public ICoordinate Coordinate + { + get { throw new NotImplementedException(); } + } + + public Double this[Ordinates ordinate] + { + get + { + switch (ordinate) + { + case Ordinates.X: + return X; + case Ordinates.Y: + return Y; + case Ordinates.Z: + case Ordinates.M: + default: + return Double.NaN; + } + } + } + + public Int32 OrdinateCount + { + get { return ComponentCount; } + } + + #endregion #region Operators /// @@ -270,6 +285,11 @@ public virtual Double this[UInt32 index] #endregion + public override Int32 PointCount + { + get { return 1; } + } + #region "Inherited methods from abstract class Geometry" /// @@ -609,6 +629,15 @@ protected void SetNotEmpty() _hasValue = true; } + #region IEnumerable Members + + public IEnumerator GetEnumerator() + { + throw new NotImplementedException(); + } + + #endregion + #region IVector Members IVector IVector.Clone() @@ -636,11 +665,6 @@ public virtual DoubleComponent[] Components } } - public IVector Negative() - { - return new Point(-_x, -_y); - } - public DoubleComponent this[Int32 index] { get @@ -743,18 +767,27 @@ public IMatrix Transpose() #endregion + #region INegatable> Members + + IVector INegatable>.Negative() + { + return new Point(-_x, -_y); + } + + #endregion + #region INegatable> Members IMatrix INegatable>.Negative() { - return Negative(); + return new Point(-_x, -_y); } #endregion #region ISubtractable> Members - public IMatrix Subtract(IMatrix b) + IMatrix ISubtractable>.Subtract(IMatrix b) { throw new NotImplementedException(); } @@ -772,7 +805,7 @@ IMatrix IHasZero>.Zero #region IAddable> Members - public IMatrix Add(IMatrix b) + IMatrix IAddable>.Add(IMatrix b) { throw new NotImplementedException(); } @@ -781,7 +814,7 @@ public IMatrix Add(IMatrix b) #region IDivisible> Members - public IMatrix Divide(IMatrix b) + IMatrix IDivisible>.Divide(IMatrix b) { throw new NotImplementedException(); } @@ -792,14 +825,14 @@ public IMatrix Divide(IMatrix b) IMatrix IHasOne>.One { - get { return One; } + get { return _one; } } #endregion #region IMultipliable> Members - public IMatrix Multiply(IMatrix b) + IMatrix IMultipliable>.Multiply(IMatrix b) { throw new NotImplementedException(); } @@ -808,25 +841,7 @@ public IMatrix Multiply(IMatrix b) #region IEquatable> Members - public Boolean Equals(IMatrix other) - { - throw new NotImplementedException(); - } - - #endregion - - #region IEnumerable Members - - public IEnumerator GetEnumerator() - { - throw new NotImplementedException(); - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + Boolean IEquatable>.Equals(IMatrix other) { throw new NotImplementedException(); } @@ -871,9 +886,9 @@ public IVector Divide(IVector b) #region IHasOne> Members - public IVector One + IVector IHasOne>.One { - get { return new Point(1, 1); } + get { return _one; } } #endregion @@ -887,33 +902,6 @@ public IVector Multiply(IVector b) #endregion - #region IPoint Members - - public ICoordinate Coordinate - { - get { throw new NotImplementedException(); } - } - - public Double this[Ordinates ordinate] - { - get - { - switch (ordinate) - { - case Ordinates.X: - return X; - case Ordinates.Y: - return Y; - case Ordinates.Z: - case Ordinates.M: - default: - return Double.NaN; - } - } - } - - #endregion - #region IVector Members Int32 IVector.ComponentCount @@ -1024,278 +1012,403 @@ IMatrix IMatrix.Transpose() #endregion - #region IEquatable> Members + #region IComparable> Members - Boolean IEquatable>.Equals(IMatrix other) + Int32 IComparable>.CompareTo(IMatrix other) { throw new NotImplementedException(); } #endregion - #region IComparable> Members + #region IComputable> Members - Int32 IComparable>.CompareTo(IMatrix other) + IMatrix IComputable>.Abs() + { + throw new NotImplementedException(); + } + + IMatrix IComputable>.Set(Double value) { throw new NotImplementedException(); } #endregion - #region IComputable> Members + #region IBooleanComparable> Members - IMatrix IComputable>.Abs() + Boolean IBooleanComparable>.GreaterThan(IMatrix value) { throw new NotImplementedException(); } - IMatrix IComputable>.Set(Double value) + Boolean IBooleanComparable>.GreaterThanOrEqualTo(IMatrix value) + { + throw new NotImplementedException(); + } + + Boolean IBooleanComparable>.LessThan(IMatrix value) + { + throw new NotImplementedException(); + } + + Boolean IBooleanComparable>.LessThanOrEqualTo(IMatrix value) { throw new NotImplementedException(); } #endregion - #region ISubtractable> Members + #region IExponential> Members - IMatrix ISubtractable>.Subtract(IMatrix b) + IMatrix IExponential>.Exp() + { + throw new NotImplementedException(); + } + + IMatrix IExponential>.Log() + { + throw new NotImplementedException(); + } + + IMatrix IExponential>.Log(Double newBase) + { + throw new NotImplementedException(); + } + + IMatrix IExponential>.Power(Double exponent) + { + throw new NotImplementedException(); + } + + IMatrix IExponential>.Sqrt() { throw new NotImplementedException(); } #endregion - #region IAddable> Members + #region IEnumerable Members - IMatrix IAddable>.Add(IMatrix b) + IEnumerator IEnumerable.GetEnumerator() { throw new NotImplementedException(); } #endregion - #region IDivisible> Members + #region ISubtractable> Members - IMatrix IDivisible>.Divide(IMatrix b) + IVector ISubtractable>.Subtract(IVector b) { throw new NotImplementedException(); } #endregion - #region IMultipliable> Members + #region IAddable> Members - IMatrix IMultipliable>.Multiply(IMatrix b) + IVector IAddable>.Add(IVector b) { throw new NotImplementedException(); } #endregion - #region IBooleanComparable> Members + #region IDivisible> Members - Boolean IBooleanComparable>.GreaterThan(IMatrix value) + IVector IDivisible>.Divide(IVector b) { throw new NotImplementedException(); } - Boolean IBooleanComparable>.GreaterThanOrEqualTo(IMatrix value) + #endregion + + #region IMultipliable> Members + + IVector IMultipliable>.Multiply(IVector b) { throw new NotImplementedException(); } - Boolean IBooleanComparable>.LessThan(IMatrix value) + #endregion + + #region IBooleanComparable> Members + + Boolean IBooleanComparable>.GreaterThan(IVector value) { throw new NotImplementedException(); } - Boolean IBooleanComparable>.LessThanOrEqualTo(IMatrix value) + Boolean IBooleanComparable>.GreaterThanOrEqualTo(IVector value) + { + throw new NotImplementedException(); + } + + Boolean IBooleanComparable>.LessThan(IVector value) + { + throw new NotImplementedException(); + } + + Boolean IBooleanComparable>.LessThanOrEqualTo(IVector value) { throw new NotImplementedException(); } #endregion - #region IExponential> Members + #region IExponential> Members - IMatrix IExponential>.Exp() + IVector IExponential>.Exp() { throw new NotImplementedException(); } - IMatrix IExponential>.Log() + IVector IExponential>.Log() { throw new NotImplementedException(); } - IMatrix IExponential>.Log(Double newBase) + IVector IExponential>.Log(Double newBase) { throw new NotImplementedException(); } - IMatrix IExponential>.Power(Double exponent) + IVector IExponential>.Power(Double exponent) { throw new NotImplementedException(); } - IMatrix IExponential>.Sqrt() + IVector IExponential>.Sqrt() { throw new NotImplementedException(); } #endregion - #region IEnumerable Members + #region IEquatable> Members - IEnumerator IEnumerable.GetEnumerator() + Boolean IEquatable>.Equals(IVector other) { throw new NotImplementedException(); } #endregion - #region IComputable> Members + #region IComparable> Members - IVector IComputable>.Abs() + Int32 IComparable>.CompareTo(IVector other) { throw new NotImplementedException(); } - IVector IComputable>.Set(Double value) + #endregion + + #region IEnumerable Members + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw new NotImplementedException(); } #endregion - #region INegatable> Members + #region IComputable Members - IVector INegatable>.Negative() + IPoint IComputable.Set(Double value) { throw new NotImplementedException(); } #endregion - #region ISubtractable> Members + #region IComputable Members - IVector ISubtractable>.Subtract(IVector b) + IPoint IComputable.Abs() + { + throw new NotImplementedException(); + } + + IPoint IComputable.Set(Double value) { throw new NotImplementedException(); } #endregion - #region IAddable> Members + #region INegatable Members - IVector IAddable>.Add(IVector b) + IPoint INegatable.Negative() { throw new NotImplementedException(); } #endregion - #region IDivisible> Members + #region ISubtractable Members - IVector IDivisible>.Divide(IVector b) + public IPoint Subtract(IPoint b) { throw new NotImplementedException(); } #endregion - #region IHasOne> Members + #region IHasZero Members - IVector IHasOne>.One + IPoint IHasZero.Zero { get { throw new NotImplementedException(); } } #endregion - #region IMultipliable> Members + #region IAddable Members - IVector IMultipliable>.Multiply(IVector b) + public IPoint Add(IPoint b) { throw new NotImplementedException(); } #endregion - #region IBooleanComparable> Members + #region IDivisible Members - Boolean IBooleanComparable>.GreaterThan(IVector value) + public IPoint Divide(IPoint b) { throw new NotImplementedException(); } - Boolean IBooleanComparable>.GreaterThanOrEqualTo(IVector value) + #endregion + + #region IHasOne Members + + IPoint IHasOne.One + { + get { throw new NotImplementedException(); } + } + + #endregion + + #region IMultipliable Members + + public IPoint Multiply(IPoint b) { throw new NotImplementedException(); } - Boolean IBooleanComparable>.LessThan(IVector value) + #endregion + + #region IBooleanComparable Members + + public Boolean GreaterThan(IPoint value) { throw new NotImplementedException(); } - Boolean IBooleanComparable>.LessThanOrEqualTo(IVector value) + public Boolean GreaterThanOrEqualTo(IPoint value) + { + throw new NotImplementedException(); + } + + public Boolean LessThan(IPoint value) + { + throw new NotImplementedException(); + } + + public Boolean LessThanOrEqualTo(IPoint value) { throw new NotImplementedException(); } #endregion - #region IExponential> Members + #region IExponential Members - IVector IExponential>.Exp() + IPoint IExponential.Exp() { throw new NotImplementedException(); } - IVector IExponential>.Log() + IPoint IExponential.Log() { throw new NotImplementedException(); } - IVector IExponential>.Log(Double newBase) + IPoint IExponential.Log(Double newBase) { throw new NotImplementedException(); } - IVector IExponential>.Power(Double exponent) + IPoint IExponential.Power(Double exponent) { throw new NotImplementedException(); } - IVector IExponential>.Sqrt() + IPoint IExponential.Sqrt() { throw new NotImplementedException(); } #endregion - #region IEquatable> Members + #region IMultipliable Members - Boolean IEquatable>.Equals(IVector other) + public IPoint Multiply(Double b) { throw new NotImplementedException(); } #endregion - #region IComparable> Members + #region IDivisible Members - Int32 IComparable>.CompareTo(IVector other) + public IPoint Divide(Double b) { throw new NotImplementedException(); } #endregion - public override Int32 PointCount + #region IComputable> Members + + IVector IComputable>.Set(Double value) { - get { return 1; } + throw new NotImplementedException(); + } + + #endregion + + #region IComputable> Members + + IVector IComputable>.Abs() + { + throw new NotImplementedException(); } + + IVector IComputable>.Set(Double value) + { + throw new NotImplementedException(); + } + + #endregion + + #region IMultipliable> Members + + IVector IMultipliable>.Multiply(Double b) + { + throw new NotImplementedException(); + } + + #endregion + + #region IDivisible> Members + + IVector IDivisible>.Divide(Double b) + { + throw new NotImplementedException(); + } + + #endregion } } diff --git a/SharpMap.SimpleGeometries/SharpMap.SimpleGeometries.csproj b/SharpMap.SimpleGeometries/SharpMap.SimpleGeometries.csproj index 5ac39b22..0c0ef245 100644 --- a/SharpMap.SimpleGeometries/SharpMap.SimpleGeometries.csproj +++ b/SharpMap.SimpleGeometries/SharpMap.SimpleGeometries.csproj @@ -59,6 +59,7 @@ + @@ -108,4 +109,4 @@ --> - \ No newline at end of file + diff --git a/SharpMap.Tests/Data/FeatureDataTableTests.cs b/SharpMap.Tests/Data/FeatureDataTableTests.cs index e5bfce7d..987a5dbf 100644 --- a/SharpMap.Tests/Data/FeatureDataTableTests.cs +++ b/SharpMap.Tests/Data/FeatureDataTableTests.cs @@ -1,5 +1,6 @@ using System; using System.Data; +using GeoAPI.Geometries; using NUnit.Framework; using SharpMap.Data; using SharpMap.Data.Providers.FeatureProvider; @@ -9,6 +10,9 @@ namespace SharpMap.Tests.Data [TestFixture] public class FeatureDataTableTests { + private static readonly IGeometryFactory _geoFactory + = new SharpMap.SimpleGeometries.GeometryFactory(); + [Test] public void CreateTable() { @@ -92,7 +96,8 @@ public void DefaultViewIsFeatureDataView() Assert.AreSame(table, view.Table); FeatureDataView featureView = view as FeatureDataView; Assert.IsNotNull(featureView); - Assert.AreEqual(Point.Empty, featureView.GeometryFilter); + // Changed to null from Point.Empty + Assert.AreEqual(null, featureView.GeometryFilter); Assert.AreEqual(DataViewRowState.CurrentRows, view.RowStateFilter); } @@ -100,7 +105,7 @@ public void DefaultViewIsFeatureDataView() public void LoadingTableFromReader() { FeatureDataTable table = new FeatureDataTable(); - FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(_geoFactory); table.Load(provider.ExecuteIntersectionQuery(provider.GetExtents())); } @@ -108,7 +113,7 @@ public void LoadingTableFromReader() public void CloneToCopiesTableStructureAndNoData() { FeatureDataTable table = new FeatureDataTable(); - FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(_geoFactory); provider.ExecuteIntersectionQuery(provider.GetExtents(), table); FeatureDataTable clone = new FeatureDataTable(); @@ -122,7 +127,7 @@ public void CloneToCopiesTableStructureAndNoData() public void MergeSchemaToSchemalessTargetShouldCreateIdenticalTable() { FeatureDataTable table = new FeatureDataTable(); - FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(_geoFactory); provider.ExecuteIntersectionQuery(provider.GetExtents(), table); FeatureDataTable target = new FeatureDataTable(); @@ -135,7 +140,7 @@ public void MergeSchemaToSchemalessTargetShouldCreateIdenticalTable() public void MergeSchemaToIdenticalTableShouldRemainIdentical() { FeatureDataTable table = new FeatureDataTable(); - FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(_geoFactory); provider.ExecuteIntersectionQuery(provider.GetExtents(), table); FeatureDataTable target = new FeatureDataTable(); @@ -150,7 +155,7 @@ public void MergeSchemaToIdenticalTableShouldRemainIdentical() public void MergeSchemaToKeyedTableShouldKeepKeyButAddOtherColumns() { FeatureDataTable table = new FeatureDataTable(); - FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(_geoFactory); provider.ExecuteIntersectionQuery(provider.GetExtents(), table); FeatureDataTable target = new FeatureDataTable("Oid"); @@ -165,7 +170,7 @@ public void MergeSchemaToKeyedTableShouldKeepKeyButAddOtherColumns() public void MergeSchemaToKeyedTableWithDifferentKeyNameButSameTypeShouldKeepKeyButAddOtherColumns() { FeatureDataTable table = new FeatureDataTable(); - FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider provider = DataSourceHelper.CreateFeatureDatasource(_geoFactory); provider.ExecuteIntersectionQuery(provider.GetExtents(), table); FeatureDataTable target = new FeatureDataTable("GID"); diff --git a/SharpMap.Tests/Data/FeatureDataViewTests.cs b/SharpMap.Tests/Data/FeatureDataViewTests.cs index 873942a8..0331831a 100644 --- a/SharpMap.Tests/Data/FeatureDataViewTests.cs +++ b/SharpMap.Tests/Data/FeatureDataViewTests.cs @@ -2,23 +2,26 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; +using GeoAPI.Coordinates; using GeoAPI.Geometries; using NUnit.Framework; using SharpMap.Data; using SharpMap.Data.Providers.FeatureProvider; using SharpMap.Expressions; +using SharpMap.SimpleGeometries; namespace SharpMap.Tests.Data { [TestFixture] public class FeatureDataViewTests { + private static readonly IGeometryFactory _geoFactory = new GeometryFactory(); #region CreatingDataViewReturnsValidDataView [Test] public void CreatingDataViewReturnsValidDataView() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); FeatureDataView view = new FeatureDataView(table); @@ -36,7 +39,7 @@ public void CreatingDataViewWithCrossesSpatialExpressionTypeNotSupported() { // This test is here so that when it is supported, the test breaks and is rewritten - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); new FeatureDataView(table, Point.Empty, SpatialExpressionType.Crosses, "", DataViewRowState.CurrentRows); @@ -48,7 +51,7 @@ public void CreatingDataViewWithContainsSpatialExpressionTypeNotSupported() { // This test is here so that when it is supported, the test breaks and is rewritten - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); new FeatureDataView(table, Point.Empty, SpatialExpressionType.Contains, "", DataViewRowState.CurrentRows); @@ -60,7 +63,7 @@ public void CreatingDataViewWithEqualsSpatialExpressionTypeNotSupported() { // This test is here so that when it is supported, the test breaks and is rewritten - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); new FeatureDataView(table, Point.Empty, SpatialExpressionType.Equals, "", DataViewRowState.CurrentRows); @@ -72,7 +75,7 @@ public void CreatingDataViewWithNoneSpatialExpressionTypeNotSupported() { // This test is here so that when it is supported, the test breaks and is rewritten - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); new FeatureDataView(table, Point.Empty, SpatialExpressionType.None, "", DataViewRowState.CurrentRows); @@ -84,7 +87,7 @@ public void CreatingDataViewWithOverlapsSpatialExpressionTypeNotSupported() { // This test is here so that when it is supported, the test breaks and is rewritten - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); new FeatureDataView(table, Point.Empty, SpatialExpressionType.Overlaps, "", DataViewRowState.CurrentRows); @@ -96,7 +99,7 @@ public void CreatingDataViewWithTouchesSpatialExpressionTypeNotSupported() { // This test is here so that when it is supported, the test breaks and is rewritten - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); new FeatureDataView(table, Point.Empty, SpatialExpressionType.Touches, "", DataViewRowState.CurrentRows); @@ -108,7 +111,7 @@ public void CreatingDataViewWithWithinSpatialExpressionTypeNotSupported() { // This test is here so that when it is supported, the test breaks and is rewritten - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); new FeatureDataView(table, Point.Empty, SpatialExpressionType.Within, "", DataViewRowState.CurrentRows); @@ -123,7 +126,7 @@ public void CreatingDataViewWithWithinSpatialExpressionTypeNotSupported() ExpectedMessage = "RowFilter expressions not supported at this time.")] public void ChangeViewAttributeFilterReturnsOnlyFilteredRows() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); FeatureDataView view = new FeatureDataView(table); @@ -151,7 +154,7 @@ public void ChangeViewAttributeFilterReturnsOnlyFilteredRows() ExpectedMessage = "RowFilter expressions not supported at this time.")] public void ChangeViewAttributeFilterTriggersNotification() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); FeatureDataView view = new FeatureDataView(table); @@ -180,7 +183,7 @@ public void ChangeViewAttributeFilterTriggersNotification() [Test] public void NullSpatialFilterReturnsAllRows() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); table.Load(data.ExecuteIntersectionQuery(data.GetExtents())); FeatureDataView view = new FeatureDataView(table); @@ -195,7 +198,7 @@ public void NullSpatialFilterReturnsAllRows() [Test] public void DefaultViewReturnsAllRows() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); table.Load(data.ExecuteIntersectionQuery(data.GetExtents())); @@ -209,16 +212,16 @@ public void DefaultViewReturnsAllRows() [Test] public void ChangeViewSpatialFilterReturnsOnlyFilteredRows() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); table.Load(data.ExecuteIntersectionQuery(data.GetExtents())); - BoundingBox queryExtents = new BoundingBox(0, 0, 10, 10); + IGeometry queryExtents = _geoFactory.CreateExtents2D(0, 0, 10, 10).ToGeometry(); List expectedRows = new List(); foreach (FeatureDataRow row in table) { - Geometry g = row.Geometry; + IGeometry g = row.Geometry; if (queryExtents.Intersects(g)) { @@ -227,7 +230,7 @@ public void ChangeViewSpatialFilterReturnsOnlyFilteredRows() } FeatureDataView view = new FeatureDataView(table); - view.GeometryFilter = queryExtents.ToGeometry(); + view.GeometryFilter = queryExtents; Assert.AreEqual(expectedRows.Count, view.Count); } @@ -239,7 +242,7 @@ public void ChangeViewSpatialFilterReturnsOnlyFilteredRows() [Test] public void ChangeViewSpatialFilterTriggersNotification() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); FeatureDataView view = new FeatureDataView(table); @@ -256,7 +259,7 @@ public void ChangeViewSpatialFilterTriggersNotification() Assert.IsFalse(resetNotificationOccured); - BoundingBox queryExtents = new BoundingBox(0, 0, 10, 10); + IExtents queryExtents = _geoFactory.CreateExtents2D(0, 0, 10, 10); view.GeometryFilter = queryExtents.ToGeometry(); Assert.IsTrue(resetNotificationOccured); @@ -269,12 +272,12 @@ public void ChangeViewSpatialFilterTriggersNotification() [Test] public void ExecutingQueryOnTableTriggersViewListChangedResetNotification() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); IExtents dataExtents = data.GetExtents(); - BoundingBox halfBounds = new BoundingBox(dataExtents.Left, dataExtents.Bottom, - dataExtents.Left + dataExtents.Width/2, - dataExtents.Bottom + dataExtents.Height/2); + IExtents halfBounds = _geoFactory.CreateExtents( + dataExtents.Min, dataExtents.Max); + halfBounds.Scale(0.5); data.ExecuteIntersectionQuery(halfBounds, table); FeatureDataView view = new FeatureDataView(table); @@ -289,9 +292,10 @@ public void ExecutingQueryOnTableTriggersViewListChangedResetNotification() } }; - BoundingBox otherHalfBounds = new BoundingBox( - dataExtents.Left + dataExtents.Width/2, dataExtents.Bottom + dataExtents.Height/2, - dataExtents.Right, dataExtents.Top); + IExtents otherHalfBounds = _geoFactory.CreateExtents( + dataExtents.Min, dataExtents.Max); + otherHalfBounds.TranslateRelative(0.5, 0.5); + otherHalfBounds.Scale(0.5); data.ExecuteIntersectionQuery(otherHalfBounds, table); @@ -305,12 +309,11 @@ public void ExecutingQueryOnTableTriggersViewListChangedResetNotification() [Test] public void AddingRowToTableTriggersViewListChangedItemAddedNotification() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); - BoundingBox dataExtents = data.GetExtents(); - BoundingBox halfBounds = new BoundingBox(dataExtents.Left, dataExtents.Bottom, - dataExtents.Left + dataExtents.Width/2, - dataExtents.Bottom + dataExtents.Height/2); + + IExtents halfBounds = data.GetExtents(); + halfBounds.Scale(0.5); data.ExecuteIntersectionQuery(halfBounds, table); FeatureDataView view = new FeatureDataView(table); @@ -341,12 +344,11 @@ public void AddingRowToTableTriggersViewListChangedItemAddedNotification() [Test] public void RemovingRowFromTableTriggersViewListChangedItemDeletedNotification() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); - BoundingBox dataExtents = data.GetExtents(); - BoundingBox halfBounds = new BoundingBox(dataExtents.Left, dataExtents.Bottom, - dataExtents.Left + dataExtents.Width/2, - dataExtents.Bottom + dataExtents.Height/2); + + IExtents halfBounds = data.GetExtents(); + halfBounds.Scale(0.5); data.ExecuteIntersectionQuery(halfBounds, table); FeatureDataView view = new FeatureDataView(table); @@ -374,12 +376,11 @@ public void RemovingRowFromTableTriggersViewListChangedItemDeletedNotification() [Test] public void ChangingRowTriggersViewListChangedItemChangedNotification() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); - BoundingBox dataExtents = data.GetExtents(); - BoundingBox halfBounds = new BoundingBox(dataExtents.Left, dataExtents.Bottom, - dataExtents.Left + dataExtents.Width/2, - dataExtents.Bottom + dataExtents.Height/2); + + IExtents halfBounds = data.GetExtents(); + halfBounds.Scale(0.5); data.ExecuteIntersectionQuery(halfBounds, table); FeatureDataView view = new FeatureDataView(table); @@ -409,12 +410,11 @@ public void ChangingRowTriggersViewListChangedItemChangedNotification() public void MovingRowTriggersViewListChangedItemMovedNotification() { // TODO: implement MovingRowTriggersViewListChangedItemMovedNotification - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); - BoundingBox dataExtents = data.GetExtents(); - BoundingBox halfBounds = new BoundingBox(dataExtents.Left, dataExtents.Bottom, - dataExtents.Left + dataExtents.Width/2, - dataExtents.Bottom + dataExtents.Height/2); + + IExtents halfBounds = data.GetExtents(); + halfBounds.Scale(0.5); data.ExecuteIntersectionQuery(halfBounds, table); FeatureDataView view = new FeatureDataView(table); @@ -439,19 +439,17 @@ public void MovingRowTriggersViewListChangedItemMovedNotification() [Test] public void SettingViewFilterToIncludeRowsNotPresentInTableCausesFeaturesRequestNotification() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); Boolean featuresRequested = false; table.FeaturesNotFound += delegate { featuresRequested = true; }; - BoundingBox dataExtents = data.GetExtents(); FeatureDataView view = new FeatureDataView(table); - BoundingBox otherHalfBounds = new BoundingBox(dataExtents.Left + dataExtents.Width/2, - dataExtents.Bottom + dataExtents.Height/2, - dataExtents.Right, - dataExtents.Top); + IExtents otherHalfBounds = data.GetExtents(); + otherHalfBounds.TranslateRelative(0.5, 0.5); + otherHalfBounds.Scale(0.5); Assert.IsFalse(featuresRequested); @@ -467,7 +465,7 @@ public void SettingViewFilterToIncludeRowsNotPresentInTableCausesFeaturesRequest [Test] public void SettingOidFilterAllowsOnlyFeaturesContainingFilteredOidsInView() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable("Oid"); data.ExecuteIntersectionQuery(data.GetExtents(), table); Guid[] ids = new Guid[3]; @@ -494,7 +492,7 @@ public void SettingOidFilterAllowsOnlyFeaturesContainingFilteredOidsInView() [Test] public void ChangingOidFilterTriggersNotification() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable("Oid"); data.ExecuteIntersectionQuery(data.GetExtents(), table); FeatureDataView view = new FeatureDataView(table); @@ -540,7 +538,7 @@ public void SettingTablePropertyImposesFiltersOnNewTable() [ExpectedException(typeof (NotSupportedException))] public void AddNewRowThrowsNotSupported() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); FeatureDataView view = new FeatureDataView(table); @@ -554,12 +552,12 @@ public void AddNewRowThrowsNotSupported() [Test] public void SettingGeometryFilterToIdenticalGeometryDoesntChangeFilterObject() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); - Geometry filter = new BoundingBox(0, 0, 10, 10).ToGeometry(); + IGeometry filter = _geoFactory.CreateExtents2D(0, 0, 10, 10).ToGeometry(); FeatureDataView view = new FeatureDataView(table, filter, "", DataViewRowState.CurrentRows); - Geometry filterCopy = filter.Clone(); + IGeometry filterCopy = filter.Clone(); Assert.AreNotSame(filter, filterCopy); Assert.AreEqual(filter, filterCopy); view.GeometryFilter = filterCopy; @@ -573,10 +571,10 @@ public void SettingGeometryFilterToIdenticalGeometryDoesntChangeFilterObject() [Test] public void SpatialQueryTypeIsWhatIsSpecifiedAtCreateTime() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); - Geometry filter = new BoundingBox(0, 0, 10, 10).ToGeometry(); + IGeometry filter = _geoFactory.CreateExtents2D(0, 0, 10, 10).ToGeometry(); FeatureDataView view = new FeatureDataView(table, filter, "", DataViewRowState.CurrentRows); Assert.AreEqual(SpatialExpressionType.Intersects, view.GeometryFilterType); } @@ -589,7 +587,7 @@ public void SpatialQueryTypeIsWhatIsSpecifiedAtCreateTime() [ExpectedException(typeof (NotImplementedException))] public void DataViewManagerIsAFeatureDataViewManager() { - FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(); + FeatureProvider data = DataSourceHelper.CreateFeatureDatasource(_geoFactory); FeatureDataTable table = new FeatureDataTable(); data.ExecuteIntersectionQuery(data.GetExtents(), table); FeatureDataSet dataSet = new FeatureDataSet(); diff --git a/SharpMap.Tests/Data/Providers/ShapeFile/ShapeFileTests.cs b/SharpMap.Tests/Data/Providers/ShapeFile/ShapeFileTests.cs index fb4b45b5..84a3d15c 100644 --- a/SharpMap.Tests/Data/Providers/ShapeFile/ShapeFileTests.cs +++ b/SharpMap.Tests/Data/Providers/ShapeFile/ShapeFileTests.cs @@ -2,9 +2,12 @@ using System.Collections.Generic; using System.Data; using System.IO; +using GeoAPI.Coordinates; using GeoAPI.CoordinateSystems; using GeoAPI.Geometries; +using GeoAPI.IO.WellKnownText; using NUnit.Framework; +using ProjNet.CoordinateSystems; using SharpMap.Data; using SharpMap.Data.Providers.ShapeFile; @@ -13,6 +16,10 @@ namespace SharpMap.Tests.Data.Providers.ShapeFile [TestFixture] public class ShapeFileTests { + private static readonly Random _rnd = new Random(); + private static readonly IGeometryFactory _geoFactory + = new SharpMap.SimpleGeometries.GeometryFactory(); + [TestFixtureSetUp] public void FixtureSetup() { @@ -158,12 +165,14 @@ public void NoPrjFileSetCoordinateSystemTest() { ShapeFileProvider shapeFile = new ShapeFileProvider(@"..\..\..\TestData\BCROADSWithoutDbf.SHP"); shapeFile.Open(); + ICoordinateSystemFactory coordSysFactory = null; String wkt = File.ReadAllText(@"..\..\..\TestData\BCROADS.prj"); - IProjectedCoordinateSystem cs = CoordinateSystemWktReader.Parse(wkt) as IProjectedCoordinateSystem; + IProjectedCoordinateSystem cs = WktEncoder.ToCoordinateSystemInfo(wkt, coordSysFactory) + as IProjectedCoordinateSystem; shapeFile.SpatialReference = cs; Assert.IsNotNull(shapeFile.SpatialReference); - Geometry g = shapeFile.GetGeometryById(0); + IGeometry g = shapeFile.GetGeometryById(0); Assert.IsTrue(g.SpatialReference.EqualParams(createExpectedCoordinateSystem())); @@ -372,13 +381,14 @@ public void GetGeometriesInViewTest() { ShapeFileProvider shapeFile = new ShapeFileProvider(@"..\..\..\TestData\BCROADS.SHP"); shapeFile.Open(); - List geometries = new List(); + List geometries = new List(); geometries.AddRange(shapeFile.ExecuteGeometryIntersectionQuery(shapeFile.GetExtents())); Assert.AreEqual(shapeFile.GetFeatureCount(), geometries.Count); geometries.Clear(); - geometries.AddRange(shapeFile.ExecuteGeometryIntersectionQuery(IExtents.Empty)); + IGeometry empty = _geoFactory.CreatePoint(); + geometries.AddRange(shapeFile.ExecuteGeometryIntersectionQuery(empty)); Assert.AreEqual(0, geometries.Count); } @@ -387,8 +397,10 @@ public void GetGeometriesInViewTest() public void GetGeometriesInViewWhenClosedThrowsExceptionTest() { ShapeFileProvider shapeFile = new ShapeFileProvider(@"..\..\..\TestData\BCROADS.SHP"); - List geometries = - new List(shapeFile.ExecuteGeometryIntersectionQuery(IExtents.Empty)); + + IGeometry empty = _geoFactory.CreatePoint(); + List geometries = + new List(shapeFile.ExecuteGeometryIntersectionQuery(empty)); } [Test] @@ -465,7 +477,8 @@ public void GetFeatureTest() { ShapeFileProvider shapeFile = new ShapeFileProvider(@"..\..\..\TestData\BCROADS.SHP"); shapeFile.Open(); - FeatureDataRow feature = shapeFile.GetFeature(0); + FeatureDataRow feature = shapeFile.GetFeature(0) as FeatureDataRow; + Assert.IsNotNull(feature); Assert.AreEqual(0, feature.Id); shapeFile.Close(); } @@ -474,8 +487,9 @@ public void GetFeatureTest() public void GetExtentsTest() { ShapeFileProvider shapeFile = new ShapeFileProvider(@"..\..\..\TestData\BCROADS.SHP"); - IExtents expected = - new IExtents(7332083.2127965018, 236823.71867240831, 7538428.618, 405610.34692560317); + IExtents expected =_geoFactory.CreateExtents2D( + 7332083.2127965018, 236823.71867240831, + 7538428.618, 405610.34692560317); IExtents actual = shapeFile.GetExtents(); Assert.AreEqual(expected, actual); } @@ -524,7 +538,7 @@ public void InsertFeatureTest() feature["DateCreated"] = dateCreated; feature["Visits"] = 0; feature["Weight"] = 100.0f; - feature.Geometry = new Point(1, 1); + feature.Geometry = _geoFactory.CreatePoint2D(1, 1); shapeFile.Insert(feature); shapeFile.Close(); @@ -536,13 +550,13 @@ public void InsertFeatureTest() FeatureDataSet dataSet = new FeatureDataSet("ShapeFile test"); - shapeFile.ExecuteIntersectionQuery(new IExtents(1, 1, 1, 1), dataSet); + shapeFile.ExecuteIntersectionQuery(_geoFactory.CreateExtents2D(1, 1, 1, 1), dataSet); Assert.AreEqual(1, dataSet.Tables.Count); Assert.AreEqual(1, dataSet.Tables[0].Rows.Count); FeatureDataRow newFeature = dataSet.Tables[0].Rows[0] as FeatureDataRow; - Assert.AreEqual(new Point(1, 1), newFeature.Geometry); + Assert.AreEqual(_geoFactory.CreatePoint2D(1, 1), newFeature.Geometry); Assert.AreEqual(newFeature["Name"], "Test feature"); DateTime dateCreatedActual = (DateTime) newFeature["DateCreated"]; Assert.AreEqual(dateCreatedActual.Year, dateCreated.Year); @@ -568,39 +582,32 @@ public void InsertFeaturesTest() ShapeFileProvider shapeFile = ShapeFileProvider.Create("UnitTestData", "Test3", ShapeType.PolyLine, schema); shapeFile.Open(); - Random rnd = new Random(); - IExtents computedBounds = IExtents.Empty; + IExtents computedBounds = _geoFactory.CreateExtents(); List> rows = new List>(); for (Int32 i = 0; i < 10000; i++) { - DateTime dateCreated = new DateTime(rnd.Next(1900, 2155), rnd.Next(1, 12), rnd.Next(1, 28)); + DateTime dateCreated = new DateTime(_rnd.Next(1900, 2155), _rnd.Next(1, 12), _rnd.Next(1, 28)); FeatureDataRow feature = schema.NewRow((UInt32) i); - Char[] chars = new Char[rnd.Next(0, 254)]; + Char[] chars = new Char[_rnd.Next(0, 254)]; for (Int32 charIndex = 0; charIndex < chars.Length; charIndex++) { - chars[charIndex] = (Char) (Byte) rnd.Next(32, 126); + chars[charIndex] = (Char) (Byte) _rnd.Next(32, 126); } feature["Name"] = new String(chars); feature["DateCreated"] = dateCreated; - feature["Visits"] = rnd.Next(0, Int32.MaxValue) << rnd.Next(0, 32); - feature["Weight"] = rnd.NextDouble()*rnd.Next(0, 100000); + feature["Visits"] = _rnd.Next(0, Int32.MaxValue) << _rnd.Next(0, 32); + feature["Weight"] = _rnd.NextDouble()*_rnd.Next(0, 100000); - LineString line = new LineString(); + ICoordinateSequence coordinates + = _geoFactory.CoordinateSequenceFactory.Create(generateCoordinates()); + + ILineString line = _geoFactory.CreateLineString(coordinates); - Int32 pointCount = rnd.Next(1, 100); - for (Int32 pointIndex = 0; pointIndex < pointCount; pointIndex++) - { - Point p = new Point(rnd.NextDouble()*rnd.Next(200000, 700000), - (rnd.NextDouble()*rnd.Next(1000000)) + 50000000); - - line.Vertices.Add(p); - } - - computedBounds.ExpandToInclude(line.GetBoundingBox()); + computedBounds.ExpandToInclude(line.Extents); feature.Geometry = line; @@ -650,9 +657,10 @@ public void DeleteFeaturesTest() private static IProjectedCoordinateSystem createExpectedCoordinateSystem() { - ICoordinateSystemFactory factory = new CoordinateSystemFactory(); + ICoordinateSystemFactory factory = new CoordinateSystemFactory( + _geoFactory.CoordinateFactory, _geoFactory); - IEllipsoid grs80 = IEllipsoid.GRS80; + IEllipsoid grs80 = Ellipsoid.Grs80; IHorizontalDatum harn = factory.CreateHorizontalDatum( DatumType.HorizontalClassic, grs80, null, "D_North_American_1983_HARN"); @@ -662,7 +670,8 @@ private static IProjectedCoordinateSystem createExpectedCoordinateSystem() IAxisInfo axis0 = new AxisInfo("Lon", AxisOrientation.East); IAxisInfo axis1 = new AxisInfo("Lat", AxisOrientation.North); - IGeographicCoordinateSystem gcs = factory.CreateGeographicCoordinateSystem( + // Made the first parameter - the IExtents - null, which should be improved + IGeographicCoordinateSystem gcs = factory.CreateGeographicCoordinateSystem(null, AngularUnit.Degrees, harn, greenwich, axis0, axis1, "GCS_North_American_1983_HARN"); IProjection prj = factory.CreateProjection( @@ -681,7 +690,8 @@ private static IProjectedCoordinateSystem createExpectedCoordinateSystem() IProjectedCoordinateSystem expected = factory.CreateProjectedCoordinateSystem( gcs, prj, LinearUnit.Foot, axis0, axis1, "NAD_1983_HARN_StatePlane_Oregon_North_FIPS_3601"); - // TODO: Check if this is correct, since on line 184 of CoorindateSystemFactory.cs, HorizontalDatum is passed in as null + // TODO: Check if this is correct, since on line 184 of CoorindateSystemFactory.cs, + // HorizontalDatum is passed in as null expected.HorizontalDatum = harn; return expected; } @@ -701,8 +711,9 @@ public void SetTableSchemaShouldMatchShapeFileSchema() { ShapeFileProvider shapeFile = new ShapeFileProvider(@"..\..\..\TestData\BCROADS.SHP"); shapeFile.Open(); + IGeometry empty = _geoFactory.CreatePoint(); FeatureDataTable queryTable = new FeatureDataTable("OID"); - shapeFile.ExecuteIntersectionQuery(IExtents.Empty, queryTable); + shapeFile.ExecuteIntersectionQuery(empty, queryTable); FeatureDataTable nonKeyedTable = new FeatureDataTable(); shapeFile.SetTableSchema(nonKeyedTable); @@ -719,8 +730,9 @@ public void SetTableSchemaWithDifferentKeyCase() { ShapeFileProvider shapeFile = new ShapeFileProvider(@"..\..\..\TestData\BCROADS.SHP"); shapeFile.Open(); + IGeometry empty = _geoFactory.CreatePoint(); FeatureDataTable queryTable = new FeatureDataTable("OID"); - shapeFile.ExecuteIntersectionQuery(IExtents.Empty, queryTable); + shapeFile.ExecuteIntersectionQuery(empty, queryTable); FeatureDataTable keyedTable = new FeatureDataTable("oid"); shapeFile.SetTableSchema(keyedTable); @@ -733,8 +745,9 @@ public void SetTableSchemaWithDifferentKeyCaseAndSchemaMergeAction() { ShapeFileProvider shapeFile = new ShapeFileProvider(@"..\..\..\TestData\BCROADS.SHP"); shapeFile.Open(); + IGeometry empty = _geoFactory.CreatePoint(); FeatureDataTable queryTable = new FeatureDataTable("OID"); - shapeFile.ExecuteIntersectionQuery(IExtents.Empty, queryTable); + shapeFile.ExecuteIntersectionQuery(empty, queryTable); FeatureDataTable keyedTable = new FeatureDataTable("oid"); shapeFile.SetTableSchema(keyedTable, SchemaMergeAction.CaseInsensitive); @@ -747,12 +760,29 @@ public void SetTableSchemaWithDifferentKeyNameAndSchemaMergeAction() { ShapeFileProvider shapeFile = new ShapeFileProvider(@"..\..\..\TestData\BCROADS.SHP"); shapeFile.Open(); + IGeometry empty = _geoFactory.CreatePoint(); FeatureDataTable queryTable = new FeatureDataTable("OID"); - shapeFile.ExecuteIntersectionQuery(IExtents.Empty, queryTable); + shapeFile.ExecuteIntersectionQuery(empty, queryTable); FeatureDataTable keyedTable = new FeatureDataTable("FID"); shapeFile.SetTableSchema(keyedTable, SchemaMergeAction.KeyByType); DataTableHelper.AssertTableStructureIdentical(keyedTable, queryTable); } + + private static IEnumerable generateCoordinates() + { + ICoordinateFactory coordFactory = _geoFactory.CoordinateFactory; + + Int32 pointCount = _rnd.Next(1, 100); + + for (Int32 pointIndex = 0; pointIndex < pointCount; pointIndex++) + { + ICoordinate p = coordFactory.Create( + _rnd.NextDouble() * _rnd.Next(200000, 700000), + (_rnd.NextDouble() * _rnd.Next(1000000)) + 50000000); + + yield return p; + } + } } } \ No newline at end of file diff --git a/SharpMap.Tests/DataSourceHelper.cs b/SharpMap.Tests/DataSourceHelper.cs index 41b4a393..a71c4ca1 100644 --- a/SharpMap.Tests/DataSourceHelper.cs +++ b/SharpMap.Tests/DataSourceHelper.cs @@ -15,21 +15,21 @@ internal static class DataSourceHelper internal static IFeatureLayerProvider CreateGeometryDatasource(IGeometryFactory geoFactory) { Collection geoms = new Collection(); - geoms.Add(GeometryFromWkt.Parse("POINT EMPTY", geoFactory)); - geoms.Add(GeometryFromWkt.Parse("GEOMETRYCOLLECTION (POINT (10 10), POINT (30 30), LINESTRING (15 15, 20 20))", geoFactory)); - geoms.Add(GeometryFromWkt.Parse("MULTIPOLYGON (((0 0, 10 0, 10 10, 0 10, 0 0)), ((5 5, 7 5, 7 7, 5 7, 5 5)))", geoFactory)); - geoms.Add(GeometryFromWkt.Parse("LINESTRING (20 20, 20 30, 30 30, 30 20, 40 20)", geoFactory)); + geoms.Add(WktEncoder.ToGeometry("POINT EMPTY", geoFactory)); + geoms.Add(WktEncoder.ToGeometry("GEOMETRYCOLLECTION (POINT (10 10), POINT (30 30), LINESTRING (15 15, 20 20))", geoFactory)); + geoms.Add(WktEncoder.ToGeometry("MULTIPOLYGON (((0 0, 10 0, 10 10, 0 10, 0 0)), ((5 5, 7 5, 7 7, 5 7, 5 5)))", geoFactory)); + geoms.Add(WktEncoder.ToGeometry("LINESTRING (20 20, 20 30, 30 30, 30 20, 40 20)", geoFactory)); geoms.Add( - GeometryFromWkt.Parse("MULTILINESTRING ((10 10, 40 50), (20 20, 30 20), (20 20, 50 20, 50 60, 20 20))", geoFactory)); - geoms.Add(GeometryFromWkt.Parse( + WktEncoder.ToGeometry("MULTILINESTRING ((10 10, 40 50), (20 20, 30 20), (20 20, 50 20, 50 60, 20 20))", geoFactory)); + geoms.Add(WktEncoder.ToGeometry( "POLYGON ((20 20, 20 30, 30 30, 30 20, 20 20), (21 21, 29 21, 29 " + "29, 21 29, 21 21), (23 23, 23 27, 27 27, 27 23, 23 23))", geoFactory)); - geoms.Add(GeometryFromWkt.Parse("POINT (58.813841159 84.7561198972)", geoFactory)); - geoms.Add(GeometryFromWkt.Parse("MULTIPOINT (20 100, 45 32, 120 54)", geoFactory)); - geoms.Add(GeometryFromWkt.Parse("MULTIPOLYGON EMPTY", geoFactory)); - geoms.Add(GeometryFromWkt.Parse("MULTILINESTRING EMPTY", geoFactory)); - geoms.Add(GeometryFromWkt.Parse("MULTIPOINT EMPTY", geoFactory)); - geoms.Add(GeometryFromWkt.Parse("LINESTRING EMPTY", geoFactory)); + geoms.Add(WktEncoder.ToGeometry("POINT (58.813841159 84.7561198972)", geoFactory)); + geoms.Add(WktEncoder.ToGeometry("MULTIPOINT (20 100, 45 32, 120 54)", geoFactory)); + geoms.Add(WktEncoder.ToGeometry("MULTIPOLYGON EMPTY", geoFactory)); + geoms.Add(WktEncoder.ToGeometry("MULTILINESTRING EMPTY", geoFactory)); + geoms.Add(WktEncoder.ToGeometry("MULTIPOINT EMPTY", geoFactory)); + geoms.Add(WktEncoder.ToGeometry("LINESTRING EMPTY", geoFactory)); return new GeometryProvider(geoms); } @@ -56,67 +56,67 @@ internal static FeatureProvider CreateFeatureDatasource(IGeometryFactory geoFact row = features.NewRow(Guid.NewGuid()); row["FeatureName"] = "An empty point"; - row.Geometry = GeometryFromWkt.Parse("POINT EMPTY", geoFactory); + row.Geometry = WktEncoder.ToGeometry("POINT EMPTY", geoFactory); features.AddRow(row); row = features.NewRow(Guid.NewGuid()); row["FeatureName"] = "A geometry collection"; row.Geometry = - GeometryFromWkt.Parse("GEOMETRYCOLLECTION (POINT (10 10), POINT (30 30), LINESTRING (15 15, 20 20))", geoFactory); + WktEncoder.ToGeometry("GEOMETRYCOLLECTION (POINT (10 10), POINT (30 30), LINESTRING (15 15, 20 20))", geoFactory); features.AddRow(row); row = features.NewRow(Guid.NewGuid()); row["FeatureName"] = "A multipolygon"; row.Geometry = - GeometryFromWkt.Parse("MULTIPOLYGON (((0 0, 10 0, 10 10, 0 10, 0 0)), ((5 5, 7 5, 7 7, 5 7, 5 5)))", geoFactory); + WktEncoder.ToGeometry("MULTIPOLYGON (((0 0, 10 0, 10 10, 0 10, 0 0)), ((5 5, 7 5, 7 7, 5 7, 5 5)))", geoFactory); features.AddRow(row); row = features.NewRow(Guid.NewGuid()); row["FeatureName"] = "A linestring"; - row.Geometry = GeometryFromWkt.Parse("LINESTRING (20 20, 20 30, 30 30, 30 20, 40 20)", geoFactory); + row.Geometry = WktEncoder.ToGeometry("LINESTRING (20 20, 20 30, 30 30, 30 20, 40 20)", geoFactory); features.AddRow(row); row = features.NewRow(Guid.NewGuid()); row["FeatureName"] = "A multilinestring"; row.Geometry = - GeometryFromWkt.Parse("MULTILINESTRING ((10 10, 40 50), (20 20, 30 20), (20 20, 50 20, 50 60, 20 20))", geoFactory); + WktEncoder.ToGeometry("MULTILINESTRING ((10 10, 40 50), (20 20, 30 20), (20 20, 50 20, 50 60, 20 20))", geoFactory); features.AddRow(row); row = features.NewRow(Guid.NewGuid()); row["FeatureName"] = "A polygon"; - row.Geometry = GeometryFromWkt.Parse( + row.Geometry = WktEncoder.ToGeometry( "POLYGON ((20 20, 20 30, 30 30, 30 20, 20 20), (21 21, 29 21, 29 " + "29, 21 29, 21 21), (23 23, 23 27, 27 27, 27 23, 23 23))", geoFactory); features.AddRow(row); row = features.NewRow(Guid.NewGuid()); row["FeatureName"] = "A point"; - row.Geometry = GeometryFromWkt.Parse("POINT (58.813841159 84.7561198972)", geoFactory); + row.Geometry = WktEncoder.ToGeometry("POINT (58.813841159 84.7561198972)", geoFactory); features.AddRow(row); row = features.NewRow(Guid.NewGuid()); row["FeatureName"] = "A multipoint"; - row.Geometry = GeometryFromWkt.Parse("MULTIPOINT (20 100, 45 32, 120 54)", geoFactory); + row.Geometry = WktEncoder.ToGeometry("MULTIPOINT (20 100, 45 32, 120 54)", geoFactory); features.AddRow(row); row = features.NewRow(Guid.NewGuid()); row["FeatureName"] = "An empty multipolygon"; - row.Geometry = GeometryFromWkt.Parse("MULTIPOLYGON EMPTY", geoFactory); + row.Geometry = WktEncoder.ToGeometry("MULTIPOLYGON EMPTY", geoFactory); features.AddRow(row); row = features.NewRow(Guid.NewGuid()); row["FeatureName"] = "An empty multilinestring"; - row.Geometry = GeometryFromWkt.Parse("MULTILINESTRING EMPTY", geoFactory); + row.Geometry = WktEncoder.ToGeometry("MULTILINESTRING EMPTY", geoFactory); features.AddRow(row); row = features.NewRow(Guid.NewGuid()); row["FeatureName"] = "An empty multipoint"; - row.Geometry = GeometryFromWkt.Parse("MULTIPOINT EMPTY", geoFactory); + row.Geometry = WktEncoder.ToGeometry("MULTIPOINT EMPTY", geoFactory); features.AddRow(row); row = features.NewRow(Guid.NewGuid()); row["FeatureName"] = "An empty linestring"; - row.Geometry = GeometryFromWkt.Parse("LINESTRING EMPTY", geoFactory); + row.Geometry = WktEncoder.ToGeometry("LINESTRING EMPTY", geoFactory); features.AddRow(row); provider.Insert(features); diff --git a/SharpMap.Tests/Geometries/MultiLinestringsTests.cs b/SharpMap.Tests/Geometries/MultiLinestringsTests.cs index 9b9c8201..efd3c934 100644 --- a/SharpMap.Tests/Geometries/MultiLinestringsTests.cs +++ b/SharpMap.Tests/Geometries/MultiLinestringsTests.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using GeoAPI.Coordinates; using GeoAPI.Geometries; using NUnit.Framework; @@ -7,16 +8,19 @@ namespace SharpMap.Tests.Geometries [TestFixture] public class MultiLinestringsTests { + private static readonly IGeometryFactory _geoFactory + = new SharpMap.SimpleGeometries.GeometryFactory(); + [Test] public void MultiLinestring() { - IMultiLineString mls = new IMultiLineString(); + IMultiLineString mls = _geoFactory.CreateMultiLineString(); Assert.IsTrue(mls.IsEmpty); - mls.Add(new ILineString()); + mls.Add(_geoFactory.CreateLineString()); Assert.IsTrue(mls.IsEmpty); - mls[0].Coordinates.Add(new Point(45, 68)); - mls[0].Coordinates.Add(new Point(82, 44)); - mls.Add(CreateLineString()); + mls[0].Coordinates.Add(_geoFactory.CreatePoint2D(45, 68)); + mls[0].Coordinates.Add(_geoFactory.CreatePoint2D(82, 44)); + mls.Add(createLineString()); foreach (ILineString ls in (IEnumerable)mls) { @@ -33,27 +37,34 @@ public void MultiLinestring() Assert.IsFalse(mls.IsClosed); //Close linestrings - foreach (ILineString ls in mls) + foreach (ILineString ls in (IEnumerable)mls) { ls.Coordinates.Add((ls.StartPoint.Clone() as IPoint).Coordinate); } - foreach (ILineString ls in mls) + foreach (ILineString ls in (IEnumerable)mls) { Assert.IsTrue(ls.IsClosed); } Assert.IsTrue(mls.IsClosed); - Assert.AreEqual(new IExtents(1, 2, 930, 123), mls.Extents); + Assert.AreEqual(_geoFactory.CreateExtents2D(1, 2, 930, 123), mls.Extents); } - private ILineString CreateLineString() + private ILineString createLineString() { - ILineString ls = new ILineString(); - ls.Coordinates.Add(new Point(1, 2)); - ls.Coordinates.Add(new Point(10, 22)); - ls.Coordinates.Add(new Point(930, 123)); + ICoordinateSequence coordinates + = _geoFactory.CoordinateSequenceFactory.Create(generateCoordinates()); + ILineString ls = _geoFactory.CreateLineString(coordinates); return ls; } + + private static IEnumerable generateCoordinates() + { + ICoordinateFactory coordFactory = _geoFactory.CoordinateFactory; + yield return coordFactory.Create(1, 2); + yield return coordFactory.Create(10, 22); + yield return coordFactory.Create(930, 123); + } } } \ No newline at end of file diff --git a/SharpMap.Tests/Geometries/PointTests.cs b/SharpMap.Tests/Geometries/PointTests.cs index f28567cc..98b7a4ec 100644 --- a/SharpMap.Tests/Geometries/PointTests.cs +++ b/SharpMap.Tests/Geometries/PointTests.cs @@ -1,4 +1,6 @@ using System; +using GeoAPI.Coordinates; +using GeoAPI.Geometries; using NUnit.Framework; namespace SharpMap.Tests.Geometries @@ -6,81 +8,83 @@ namespace SharpMap.Tests.Geometries [TestFixture] public class PointTests { + private static readonly IGeometryFactory _geoFactory + = new SharpMap.SimpleGeometries.GeometryFactory(); + [Test] - public void Point() + public void IPoint() { - //Do various Point method calls to cover the point class with sufficient testing - Point p0 = new Point(); - Point p1 = new Point(0, 0); - Point p2 = new Point(450, 120); - Assert.IsTrue(p0.IsEmpty()); - Assert.IsFalse(p1.IsEmpty()); + //Do various IPoint method calls to cover the point class with sufficient testing + IPoint2D p0 = _geoFactory.CreatePoint() as IPoint2D; + IPoint2D p1 = _geoFactory.CreatePoint2D(0, 0); + IPoint2D p2 = _geoFactory.CreatePoint2D(450, 120); + + Assert.IsTrue(p0.IsEmpty); + Assert.IsFalse(p1.IsEmpty); Assert.AreNotEqual(p0, p1); Assert.AreEqual(450, p2.X); Assert.AreEqual(120, p2.Y); Assert.AreNotSame(p2.Clone(), p2); - p0 = p2.Clone() as Point; - p0.X += 100; - p0.Y = 150; - p0[0] = p0[0].Add(p0[1]); - Assert.AreEqual(new Point(700, 150), p0); - Assert.AreEqual(p2, p2.GetBoundingBox().Min); - Assert.AreEqual(p2, p2.GetBoundingBox().Max); - Assert.IsTrue(p2.IsSimple()); - Assert.IsFalse(p2.IsEmpty()); - Assert.AreEqual(2, p2.NumOrdinates); - Assert.AreEqual(new Point(400, 100), p2 + new Point(-50, -20)); - Assert.AreEqual(new Point(500, 100), p2 - new Point(-50, 20)); - Assert.AreEqual(new Point(900, 240), p2*2); + p0 = _geoFactory.CreatePoint2D(p2.X + 100, 150); + p0 = _geoFactory.CreatePoint2D(p0.X + p0.Y, p0.Y); + Assert.AreEqual(_geoFactory.CreatePoint2D(700, 150), p0); + Assert.AreEqual(p2.Coordinate, p2.Extents.Min); + Assert.AreEqual(p2.Coordinate, p2.Extents.Max); + Assert.IsTrue(p2.IsSimple); + Assert.IsFalse(p2.IsEmpty); + Assert.AreEqual(2, p2.OrdinateCount); + Assert.AreEqual(_geoFactory.CreatePoint2D(400, 100), p2.Add(_geoFactory.CreatePoint2D(-50, -20))); + Assert.AreEqual(_geoFactory.CreatePoint2D(500, 100), p2.Subtract(_geoFactory.CreatePoint2D(-50, 20))); + Assert.AreEqual(_geoFactory.CreatePoint2D(900, 240), p2.Multiply(2)); Assert.AreEqual(0, p2.Dimension); - Assert.AreEqual(450, (Double)p2[0]); - Assert.AreEqual(120, (Double)p2[1]); - Assert.IsNull(p2.Boundary()); - Assert.AreEqual(p2.X.GetHashCode() ^ p2.Y.GetHashCode() ^ p2.IsEmpty().GetHashCode(), p2.GetHashCode()); + Assert.AreEqual(450, p2[Ordinates.X]); + Assert.AreEqual(120, p2[Ordinates.Y]); + Assert.IsNull(p2.Boundary); + Assert.AreEqual(p2.X.GetHashCode() ^ p2.Y.GetHashCode() ^ p2.IsEmpty.GetHashCode(), p2.GetHashCode()); Assert.Greater(p2.CompareTo(p1), 0); Assert.Less(p1.CompareTo(p2), 0); - Assert.AreEqual(p2.CompareTo(new Point(450, 120)), 0); + Assert.AreEqual(p2.CompareTo(_geoFactory.CreatePoint2D(450, 120)), 0); } [Test] public void Point3D() { - //Do various Point method calls to cover the point class with sufficient testing - Point3D p0 = new Point3D(); - Point p = new Point(23, 21); - Point3D p1 = new Point3D(450, 120, 34); - Point3D p2 = new Point3D(p, 94); - Assert.IsTrue(p0.IsEmpty()); - Assert.IsFalse(p1.IsEmpty()); - Assert.IsFalse(p2.IsEmpty()); + //Do various IPoint method calls to cover the point class with sufficient testing + IPoint3D p0 = _geoFactory.CreatePoint3D(); + IPoint2D p = _geoFactory.CreatePoint2D(23, 21); + IPoint3D p1 = _geoFactory.CreatePoint3D(450, 120, 34); + IPoint3D p2 = _geoFactory.CreatePoint3D(p, 94); + Assert.IsTrue(p0.IsEmpty); + Assert.IsFalse(p1.IsEmpty); + Assert.IsFalse(p2.IsEmpty); Assert.AreNotEqual(p, p2); Assert.AreEqual(94, p2.Z); Assert.AreNotSame(p1.Clone(), p1); - p0 = p1.Clone(); - p0.X += 100; - p0.Y = 150; - p0.Z += 499; - p0[2] = ((Double) p0[2]) + ((Double) p0[2]); - Assert.AreEqual(new Point3D(550, 150, 1066), p0); - Assert.AreEqual(p2.AsPoint(), p2.GetBoundingBox().Min); - Assert.AreEqual(p2.AsPoint(), p2.GetBoundingBox().Max); - Assert.AreEqual(3, p2.NumOrdinates); - Assert.AreEqual(new Point3D(-27, 1, 123), p2 + new Point3D(-50, -20, 29)); - Assert.AreEqual(new Point(73, 1), p2 - new Point(-50, 20)); - Assert.AreEqual(new Point3D(46, 42, 188), p2*2); + //p0 = p1.Clone(); + //p0.X += 100; + //p0.Y = 150; + //p0.Z += 499; + p0 = _geoFactory.CreatePoint3D(p0, (p0[Ordinates.Z]) + (p0[Ordinates.Z])); + Assert.AreEqual(_geoFactory.CreatePoint3D(550, 150, 1066), p0); + Assert.AreEqual(p2.Coordinate, p2.Extents.Min); + Assert.AreEqual(p2.Coordinate, p2.Extents.Max); + Assert.AreEqual(3, p2.OrdinateCount); + Assert.AreEqual(_geoFactory.CreatePoint3D(-27, 1, 123), p2.Add(_geoFactory.CreatePoint3D(-50, -20, 29))); + Assert.AreEqual(_geoFactory.CreatePoint3D(73, 1, 0), p2.Subtract(_geoFactory.CreatePoint2D(-50, 20))); + Assert.AreEqual(_geoFactory.CreatePoint3D(46, 42, 188), p2.Multiply(2)); Assert.AreEqual(0, p2.Dimension); - Assert.AreEqual(23, (Double)p2[0], TestConstants.Epsilon); - Assert.AreEqual(21, (Double)p2[1], TestConstants.Epsilon); - Assert.AreEqual(94, (Double)p2[2], TestConstants.Epsilon); - Assert.IsNull(p2.Boundary()); - Assert.AreEqual(p2.X.GetHashCode() ^ p2.Y.GetHashCode() ^ p2.Z.GetHashCode() ^ p2.IsEmpty().GetHashCode(), + Assert.AreEqual(23, p2.X, TestConstants.Epsilon); + Assert.AreEqual(21, p2.Y, TestConstants.Epsilon); + Assert.AreEqual(94, p2.Z, TestConstants.Epsilon); + Assert.IsNull(p2.Boundary); + Assert.AreEqual(p2.X.GetHashCode() ^ p2.Y.GetHashCode() ^ p2.Z.GetHashCode() ^ p2.IsEmpty.GetHashCode(), p2.GetHashCode()); Assert.Less(p2.CompareTo(p1), 0); Assert.Greater(p1.CompareTo(p2), 0); - Assert.AreEqual(0, p2.CompareTo(new Point3D(23, 21, 94))); - Assert.AreEqual(0, p2.CompareTo(new Point(23, 21))); + Assert.AreEqual(0, p2.CompareTo(_geoFactory.CreatePoint3D(23, 21, 94))); + Assert.AreEqual(0, p2.CompareTo(_geoFactory.CreatePoint2D(23, 21))); } } } \ No newline at end of file diff --git a/SharpMap.Tests/Layers/LayerTests.cs b/SharpMap.Tests/Layers/LayerTests.cs index 4cd61dbf..533110e4 100644 --- a/SharpMap.Tests/Layers/LayerTests.cs +++ b/SharpMap.Tests/Layers/LayerTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using GeoAPI.Geometries; using NUnit.Framework; using SharpMap.Data; using SharpMap.Layers; @@ -9,15 +10,17 @@ namespace SharpMap.Tests.Layers [TestFixture] public class LayerTests { + private static readonly IGeometryFactory _geoFactory + = new SharpMap.SimpleGeometries.GeometryFactory(); [Test] [Ignore("Test deferred until caching detection improved")] public void LayerCachingTest() { - GeometryLayer layer1 = DataSourceHelper.CreateFeatureFeatureLayer(); - GeometryLayer layer2 = DataSourceHelper.CreateFeatureFeatureLayer(); + GeometryLayer layer1 = DataSourceHelper.CreateFeatureFeatureLayer(_geoFactory); + GeometryLayer layer2 = DataSourceHelper.CreateFeatureFeatureLayer(_geoFactory); - BoundingBox box1 = new BoundingBox(0, 0, 10, 10); - BoundingBox box2 = new BoundingBox(35, 25, 45, 35); + IExtents box1 = _geoFactory.CreateExtents2D(0, 0, 10, 10); + IExtents box2 = _geoFactory.CreateExtents2D(35, 25, 45, 35); layer1.AsyncQuery = false; // Do query diff --git a/SharpMap.Tests/MapTests.cs b/SharpMap.Tests/MapTests.cs index 44d997a6..5ff21881 100644 --- a/SharpMap.Tests/MapTests.cs +++ b/SharpMap.Tests/MapTests.cs @@ -1,4 +1,5 @@ using System; +using GeoAPI.Geometries; using NUnit.Framework; using Rhino.Mocks; using SharpMap.Data; @@ -10,12 +11,15 @@ namespace SharpMap.Tests [TestFixture] public class MapTests { + private static readonly IGeometryFactory _geoFactory + = new SharpMap.SimpleGeometries.GeometryFactory(); + [Test] public void GetLayerByNameReturnsCorrectLayer() { MockRepository mocks = new MockRepository(); - Map map = new Map(); + Map map = new Map(_geoFactory); IFeatureLayerProvider dataSource = mocks.Stub(); map.AddLayer(new GeometryLayer("Layer 1", dataSource)); @@ -31,8 +35,8 @@ public void GetLayerByNameReturnsCorrectLayer() [ExpectedException(typeof (DuplicateLayerException))] public void DuplicateLayerNamesThrowsException() { - Map map = new Map(); - IFeatureLayerProvider dataSource = DataSourceHelper.CreateFeatureDatasource(); + Map map = new Map(_geoFactory); + IFeatureLayerProvider dataSource = DataSourceHelper.CreateFeatureDatasource(_geoFactory); map.AddLayer(new GeometryLayer("Layer 1", dataSource)); map.AddLayer(new GeometryLayer("Layer 3", dataSource)); @@ -45,7 +49,7 @@ public void FindLayerByPredicateReturnsMatchingLayers() { MockRepository mocks = new MockRepository(); - Map map = new Map(); + Map map = new Map(_geoFactory); IFeatureLayerProvider dataSource = mocks.Stub(); map.AddLayer(new GeometryLayer("Layer 1", dataSource)); @@ -67,9 +71,11 @@ public void FindLayerByPredicateReturnsMatchingLayers() [Test] public void EmptyMap_Defaults() { - Map map = new Map(); - Assert.AreEqual(map.Extents, BoundingBox.Empty); - Assert.AreEqual(map.Center, Point.Empty); + Map map = new Map(_geoFactory); + IExtents emptyExtents = _geoFactory.CreateExtents(); + Assert.AreEqual(map.Extents, emptyExtents); + // changed to null from Point.Empty + Assert.AreEqual(map.Center, null); Assert.IsNotNull(map.Layers); Assert.AreEqual(map.Layers.Count, 0); Assert.AreEqual(map.ActiveTool, StandardMapTools2D.None); @@ -79,13 +85,13 @@ public void EmptyMap_Defaults() [Test] public void GetExtents_ValidDatasource() { - Map map = new Map(); + Map map = new Map(_geoFactory); - GeometryLayer vLayer = new GeometryLayer("Geom layer", DataSourceHelper.CreateGeometryDatasource()); + GeometryLayer vLayer = new GeometryLayer("Geom layer", DataSourceHelper.CreateGeometryDatasource(_geoFactory)); map.AddLayer(vLayer); - BoundingBox box = map.Extents; - Assert.AreEqual(new BoundingBox(0, 0, 120, 100), box); + IExtents box = map.Extents; + Assert.AreEqual(_geoFactory.CreateExtents2D(0, 0, 120, 100), box); } } } \ No newline at end of file diff --git a/SharpMap.Tests/Presentation/MapPresenter2DTests.cs b/SharpMap.Tests/Presentation/MapPresenter2DTests.cs index 17f6dcec..9fece706 100644 --- a/SharpMap.Tests/Presentation/MapPresenter2DTests.cs +++ b/SharpMap.Tests/Presentation/MapPresenter2DTests.cs @@ -21,6 +21,9 @@ namespace SharpMap.Tests.Presentation [TestFixture] public class MapPresenter2DTests { + private static readonly IGeometryFactory _geoFactory + = new SharpMap.SimpleGeometries.GeometryFactory(); + #region Manual fakes #region ViewEvents @@ -186,7 +189,7 @@ internal Matrix2D ToWorldTransform get { return ToWorldTransformInternal; } } - internal IExtents ViewEnvelope + internal IExtents2D ViewEnvelope { get { return ViewEnvelopeInternal; } } @@ -222,7 +225,7 @@ internal void ZoomToViewBounds(Rectangle2D viewBounds) ZoomToViewBoundsInternal(viewBounds); } - internal void ZoomToWorldBounds(IExtents zoomBox) + internal void ZoomToWorldBounds(IExtents2D zoomBox) { ZoomToWorldBoundsInternal(zoomBox); } @@ -270,7 +273,7 @@ protected override void SetViewMinimumWorldWidth(Double fromMinWidth, Double toM { } - protected override void SetViewEnvelope(IExtents fromEnvelope, IExtents toEnvelope) + protected override void SetViewEnvelope(IExtents2D fromEnvelope, IExtents2D toEnvelope) { } @@ -333,11 +336,11 @@ public void RaiseMoveTo(Point2D point) public event EventHandler> MinimumWorldWidthChangeRequested; public event EventHandler> OffsetChangeRequested; public event EventHandler SizeChanged; - public event EventHandler> ViewEnvelopeChangeRequested; + public event EventHandler> ViewEnvelopeChangeRequested; public event EventHandler> WorldAspectRatioChangeRequested; public event EventHandler ZoomToExtentsRequested; public event EventHandler> ZoomToViewBoundsRequested; - public event EventHandler> ZoomToWorldBoundsRequested; + public event EventHandler> ZoomToWorldBoundsRequested; public event EventHandler> ZoomToWorldWidthRequested; #endregion @@ -418,7 +421,7 @@ public IPoint ToWorld(Double x, Double y) return _presenter.ToWorld(x, y); } - public IExtents ViewEnvelope + public IExtents2D ViewEnvelope { get { return _presenter.ViewEnvelope; } set @@ -488,7 +491,7 @@ public void ZoomToViewBounds(Rectangle2D viewBounds) OnRequestZoomToViewBounds(viewBounds); } - public void ZoomToWorldBounds(IExtents zoomBox) + public void ZoomToWorldBounds(IExtents2D zoomBox) { OnRequestZoomToWorldBounds(zoomBox); } @@ -637,14 +640,14 @@ private void OnRequestMinimumWorldWidthChange(Double current, Double requested) } } - private void OnRequestViewEnvelopeChange(IExtents current, IExtents requested) + private void OnRequestViewEnvelopeChange(IExtents2D current, IExtents2D requested) { - EventHandler> e = ViewEnvelopeChangeRequested; + EventHandler> e = ViewEnvelopeChangeRequested; if (e != null) { - MapViewPropertyChangeEventArgs args = - new MapViewPropertyChangeEventArgs(current, requested); + MapViewPropertyChangeEventArgs args = + new MapViewPropertyChangeEventArgs(current, requested); e(this, args); } @@ -699,14 +702,14 @@ private void OnRequestZoomToViewBounds(Rectangle2D viewBounds) } } - private void OnRequestZoomToWorldBounds(IExtents zoomBox) + private void OnRequestZoomToWorldBounds(IExtents2D zoomBox) { - EventHandler> e = ZoomToWorldBoundsRequested; + EventHandler> e = ZoomToWorldBoundsRequested; if (e != null) { - MapViewPropertyChangeEventArgs args = - new MapViewPropertyChangeEventArgs(ViewEnvelope, zoomBox); + MapViewPropertyChangeEventArgs args = + new MapViewPropertyChangeEventArgs(ViewEnvelope, zoomBox); e(this, args); } @@ -735,7 +738,7 @@ public void InitalizingMapPresenterWithEmptyMapHasUndefinedView() { MockRepository mocks = new MockRepository(); - Map map = new Map(); + Map map = new Map(_geoFactory); IMapView2D mapView = mocks.Stub(); SetupResult.For(mapView.Dpi).Return(ScreenHelper.Dpi); @@ -744,7 +747,8 @@ public void InitalizingMapPresenterWithEmptyMapHasUndefinedView() mocks.ReplayAll(); TestPresenter2D mapPresenter = new TestPresenter2D(map, mapView); - Assert.AreEqual(IPoint.Empty, mapPresenter.GeoCenter); + // Changed to null from Point.Empty + Assert.AreEqual(null, mapPresenter.GeoCenter); Assert.AreEqual(0, mapPresenter.WorldWidth); Assert.AreEqual(0, mapPresenter.WorldHeight); Assert.AreEqual(0, mapPresenter.WorldUnitsPerPixel); @@ -753,8 +757,9 @@ public void InitalizingMapPresenterWithEmptyMapHasUndefinedView() Assert.AreEqual(0, mapPresenter.PixelWorldHeight); Assert.AreEqual(null, mapPresenter.ToViewTransform); Assert.AreEqual(null, mapPresenter.ToWorldTransform); - Assert.AreEqual(Point2D.Empty, mapPresenter.ToView(new IPoint(50, 50))); - Assert.AreEqual(IPoint.Empty, mapPresenter.ToWorld(new Point2D(100, 100))); + Assert.AreEqual(Point2D.Empty, mapPresenter.ToView(_geoFactory.CreatePoint2D(50, 50))); + // Changed to null from Point.Empty + Assert.AreEqual(null, mapPresenter.ToWorld(new Point2D(100, 100))); } [Test] @@ -762,8 +767,8 @@ public void InitalizingMapPresenterWithNonEmptyMapHasUndefinedView() { MockRepository mocks = new MockRepository(); - Map map = new Map(); - map.AddLayer(DataSourceHelper.CreateFeatureFeatureLayer()); + Map map = new Map(_geoFactory); + map.AddLayer(DataSourceHelper.CreateFeatureFeatureLayer(_geoFactory)); IMapView2D mapView = mocks.Stub(); @@ -783,8 +788,9 @@ public void InitalizingMapPresenterWithNonEmptyMapHasUndefinedView() Assert.AreEqual(0, mapPresenter.PixelWorldHeight); Assert.AreEqual(null, mapPresenter.ToViewTransform); Assert.AreEqual(null, mapPresenter.ToWorldTransform); - Assert.AreEqual(Point2D.Empty, mapPresenter.ToView(new IPoint(50, 50))); - Assert.AreEqual(IPoint.Empty, mapPresenter.ToWorld(new Point2D(100, 100))); + Assert.AreEqual(Point2D.Empty, mapPresenter.ToView(_geoFactory.CreatePoint2D(50, 50))); + // Changed to null from Point.Empty + Assert.AreEqual(null, mapPresenter.ToWorld(new Point2D(100, 100))); } [Test] @@ -816,8 +822,8 @@ public void ViewEnvelopeMeasuresCorrectly() mapPresenter.ZoomToExtents(); - IExtents expected = new IExtents(0, 0, 120, 100); - Assert.AreEqual(new IPoint(60, 50), mapPresenter.GeoCenter); + IExtents expected = _geoFactory.CreateExtents2D(0, 0, 120, 100); + Assert.AreEqual(_geoFactory.CreatePoint2D(60, 50), mapPresenter.GeoCenter); Assert.AreEqual(1, mapPresenter.WorldUnitsPerPixel); Assert.AreEqual(120, mapPresenter.WorldWidth); Assert.AreEqual(100, mapPresenter.WorldHeight); @@ -865,7 +871,7 @@ public void PanTest() view.RaiseMoveTo(new Point2D(0, 0)); view.RaiseEnd(new Point2D(0, 0)); - Assert.AreEqual(new IPoint(62.5, 50), mapPresenter.GeoCenter); + Assert.AreEqual(_geoFactory.CreatePoint2D(62.5, 50), mapPresenter.GeoCenter); } [Test] @@ -941,7 +947,7 @@ public void ZoomingInFromViewCalculatesCorrectViewMetrics() Assert.AreEqual(120, mapPresenter.WorldWidth); Assert.AreEqual(150, mapPresenter.WorldHeight); - Assert.AreEqual(new IPoint(60, 50), mapPresenter.GeoCenter); + Assert.AreEqual(_geoFactory.CreatePoint2D(60, 50), mapPresenter.GeoCenter); Map map = mapPresenter.Map; @@ -954,13 +960,13 @@ public void ZoomingInFromViewCalculatesCorrectViewMetrics() Assert.AreEqual(100, mapPresenter.WorldWidth); Assert.AreEqual(125, mapPresenter.WorldHeight); - Assert.AreEqual(new IPoint(60, 50), mapPresenter.GeoCenter); + Assert.AreEqual(_geoFactory.CreatePoint2D(60, 50), mapPresenter.GeoCenter); mapPresenter.ZoomToExtents(); Assert.AreEqual(120, mapPresenter.WorldWidth); Assert.AreEqual(150, mapPresenter.WorldHeight); - Assert.AreEqual(new IPoint(60, 50), mapPresenter.GeoCenter); + Assert.AreEqual(_geoFactory.CreatePoint2D(60, 50), mapPresenter.GeoCenter); // Zoom using selection view.RaiseBegin(new Point2D(100, 125)); @@ -969,7 +975,7 @@ public void ZoomingInFromViewCalculatesCorrectViewMetrics() Assert.AreEqual(60, mapPresenter.WorldWidth); Assert.AreEqual(75, mapPresenter.WorldHeight); - Assert.AreEqual(new IPoint(60, 50), mapPresenter.GeoCenter); + Assert.AreEqual(_geoFactory.CreatePoint2D(60, 50), mapPresenter.GeoCenter); } [Test] @@ -1110,7 +1116,7 @@ public void ZoomToViewBounds_NoAspectCorrection() mapPresenter.ZoomToExtents(); mapPresenter.ZoomToViewBounds(new Rectangle2D(300, 300, 900, 900)); - Assert.AreEqual(new IPoint(72, 38), mapPresenter.GeoCenter); + Assert.AreEqual(_geoFactory.CreatePoint2D(72, 38), mapPresenter.GeoCenter); Assert.AreEqual(72, mapPresenter.WorldWidth); Assert.AreEqual(72, mapPresenter.WorldHeight); } @@ -1130,7 +1136,7 @@ public void ZoomToViewBounds_WithAspectCorrection() Assert.AreEqual(120, mapPresenter.WorldHeight); // Zoom to a 200x100 rectangle in view coordinates mapPresenter.ZoomToViewBounds(new Rectangle2D(100, 50, 300, 150)); - Assert.AreEqual(new IPoint(60, 50), mapPresenter.GeoCenter); + Assert.AreEqual(_geoFactory.CreatePoint2D(60, 50), mapPresenter.GeoCenter); Assert.AreEqual(60, mapPresenter.WorldWidth); Assert.AreEqual(60, mapPresenter.WorldHeight); } @@ -1142,8 +1148,8 @@ public void ZoomToWorldBounds_NoAspectCorrection() TestPresenter2D mapPresenter = createPresenter(mocks, 1000, 1000); - mapPresenter.ZoomToWorldBounds(new IExtents(20, 50, 100, 80)); - Assert.AreEqual(new IPoint(60, 65), mapPresenter.GeoCenter); + mapPresenter.ZoomToWorldBounds(_geoFactory.CreateExtents2D(20, 50, 100, 80)); + Assert.AreEqual(_geoFactory.CreatePoint2D(60, 65), mapPresenter.GeoCenter); Assert.AreEqual(80, mapPresenter.WorldWidth); } @@ -1154,8 +1160,8 @@ public void ZoomToWorldBounds_WithAspectCorrection() TestPresenter2D mapPresenter = createPresenter(mocks, 400, 200); mapPresenter.WorldAspectRatio = 2; - mapPresenter.ZoomToWorldBounds(new IExtents(20, 10, 100, 180)); - Assert.AreEqual(new IPoint(60, 95), mapPresenter.GeoCenter); + mapPresenter.ZoomToWorldBounds(_geoFactory.CreateExtents2D(20, 10, 100, 180)); + Assert.AreEqual(_geoFactory.CreatePoint2D(60, 95), mapPresenter.GeoCenter); Assert.AreEqual(170, mapPresenter.WorldWidth); Assert.AreEqual(170, mapPresenter.WorldHeight); } @@ -1167,11 +1173,11 @@ public void WorldToViewTests() TestPresenter2D mapPresenter = createPresenter(mocks, 1000, 1000); - mapPresenter.GeoCenter = new IPoint(23, 34); + mapPresenter.GeoCenter = _geoFactory.CreatePoint2D(23, 34); mapPresenter.ZoomToWorldWidth(2500); Point2D p1 = mapPresenter.ToView(8, 50); - Point2D p2 = mapPresenter.ToView(new IPoint(8, 50)); + Point2D p2 = mapPresenter.ToView(_geoFactory.CreatePoint2D(8, 50)); Assert.AreEqual(new Point2D(494, 493.6), p1); Assert.AreEqual(p1, p2); } @@ -1183,12 +1189,12 @@ public void ViewToWorldTests() TestPresenter2D mapPresenter = createPresenter(mocks, 500, 200); - mapPresenter.GeoCenter = new IPoint(23, 34); + mapPresenter.GeoCenter = _geoFactory.CreatePoint2D(23, 34); mapPresenter.ZoomToWorldWidth(1000); IPoint p1 = mapPresenter.ToWorld(242.5f, 92); IPoint p2 = mapPresenter.ToWorld(new Point2D(242.5f, 92)); - Assert.AreEqual(new IPoint(8, 50), p1); + Assert.AreEqual(_geoFactory.CreatePoint2D(8, 50), p1); Assert.AreEqual(p1, p2); } @@ -1202,7 +1208,7 @@ public void GetMap_GeometryProvider_ReturnImage() Map map = mapPresenter.Map; - GeometryLayer vLayer = new GeometryLayer("Geom layer", DataSourceHelper.CreateGeometryDatasource()); + GeometryLayer vLayer = new GeometryLayer("Geom layer", DataSourceHelper.CreateGeometryDatasource(_geoFactory)); vLayer.Style.Outline = new StylePen(StyleColor.Red, 2f); vLayer.Style.EnableOutline = true; vLayer.Style.Line = new StylePen(StyleColor.Green, 2f); @@ -1235,8 +1241,8 @@ public void GetMap_GeometryProvider_ReturnImage() private static TestPresenter2D createPresenter(MockRepository mocks, Double width, Double height) { - Map map = new Map(); - map.AddLayer(DataSourceHelper.CreateFeatureFeatureLayer()); + Map map = new Map(_geoFactory); + map.AddLayer(DataSourceHelper.CreateFeatureFeatureLayer(_geoFactory)); //map.AddLayer(DataSourceHelper.CreateGeometryFeatureLayer()); IMapView2D mapView = mocks.Stub(); @@ -1249,8 +1255,8 @@ private static TestPresenter2D createPresenter(MockRepository mocks, Double widt private static TestPresenter2D createPresenter(Double width, Double height, out TestView2D view) { - Map map = new Map(); - map.AddLayer(DataSourceHelper.CreateFeatureFeatureLayer()); + Map map = new Map(_geoFactory); + map.AddLayer(DataSourceHelper.CreateFeatureFeatureLayer(_geoFactory)); //map.AddLayer(DataSourceHelper.CreateGeometryFeatureLayer()); view = new TestView2D(map); diff --git a/SharpMap.Tests/Presentation/ToolsPresenterTests.cs b/SharpMap.Tests/Presentation/ToolsPresenterTests.cs index 9e7a1c5d..8735a4dd 100644 --- a/SharpMap.Tests/Presentation/ToolsPresenterTests.cs +++ b/SharpMap.Tests/Presentation/ToolsPresenterTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections; +using GeoAPI.Geometries; using NUnit.Framework; using Rhino.Mocks; using Rhino.Mocks.Interfaces; @@ -12,6 +13,9 @@ namespace SharpMap.Tests.Presentation [TestFixture] public class ToolsPresenterTests { + private static readonly IGeometryFactory _geoFactory + = new SharpMap.SimpleGeometries.GeometryFactory(); + [Test] public void PresenterSetsTools() { @@ -21,7 +25,7 @@ public void PresenterSetsTools() mocks.ReplayAll(); - Map map = new Map(); + Map map = new Map(_geoFactory); ToolsPresenter toolsPresenter = new ToolsPresenter(map, view); Assert.IsNotNull(view.Tools); @@ -40,7 +44,7 @@ public void ViewInitiatesToolSelectionChangeRequest() mocks.ReplayAll(); - Map map = new Map(); + Map map = new Map(_geoFactory); ToolsPresenter toolsPresenter = new ToolsPresenter(map, view); Random rnd = new Random(); diff --git a/SharpMap.Tests/Rendering/BasicGeometryRenderer2DTests.cs b/SharpMap.Tests/Rendering/BasicGeometryRenderer2DTests.cs index 4cde8931..9646fccc 100644 --- a/SharpMap.Tests/Rendering/BasicGeometryRenderer2DTests.cs +++ b/SharpMap.Tests/Rendering/BasicGeometryRenderer2DTests.cs @@ -5,6 +5,7 @@ using SharpMap.Data; using SharpMap.Rendering; using SharpMap.Rendering.Rendering2D; +using SharpMap.SimpleGeometries; using SharpMap.Styles; using IVectorD = NPack.Interfaces.IVector; using IMatrixD = NPack.Interfaces.IMatrix; @@ -18,6 +19,7 @@ namespace SharpMap.Tests.Rendering [TestFixture] public class BasicGeometryRenderer2DTests { + private static readonly IGeometryFactory _geoFactory = new GeometryFactory(); #region Test stub types private struct RenderObject @@ -142,7 +144,7 @@ public override IEnumerable RenderSymbols(IEnumerable loc [Ignore("Test not yet implemented")] public void RenderFeatureTest() { - IFeatureLayerProvider provider = DataSourceHelper.CreateGeometryDatasource(); + IFeatureLayerProvider provider = DataSourceHelper.CreateGeometryDatasource(_geoFactory); TestVectorRenderer vectorRenderer = new TestVectorRenderer(); BasicGeometryRenderer2D geometryRenderer = new BasicGeometryRenderer2D(vectorRenderer); diff --git a/SharpMap.Tests/Rendering/ColorMatrixTests.cs b/SharpMap.Tests/Rendering/ColorMatrixTests.cs index a68c3ef2..5e68f871 100644 --- a/SharpMap.Tests/Rendering/ColorMatrixTests.cs +++ b/SharpMap.Tests/Rendering/ColorMatrixTests.cs @@ -17,7 +17,7 @@ public class ColorMatrixTests [Test] public void ResetTest() { - ColorMatrix m1 = new ColorMatrix(1, 1, 1, 1, 0, 0, 0); + ColorMatrix m1 = new ColorMatrix(1, 1, 1, 1, 0, 0, 0, 0); m1.Reset(); @@ -27,7 +27,7 @@ public void ResetTest() [Test] public void InvertTest() { - ColorMatrix m1 = new ColorMatrix(0.5, 0.5, 0.5, 0.5, 10, 20, 30); + ColorMatrix m1 = new ColorMatrix(0.5, 0.5, 0.5, 0.5, 10, 20, 30, 0); IMatrix expected = new Matrix(MatrixFormat.RowMajor, new DoubleComponent[][] { @@ -52,7 +52,7 @@ public void InvertTest() [Test] public void IsInvertableTest() { - ColorMatrix m1 = new ColorMatrix(1, 1, 1, 1, 0, 0, 0); + ColorMatrix m1 = new ColorMatrix(1, 1, 1, 1, 0, 0, 0, 0); Assert.IsTrue(m1.IsInvertible); } @@ -60,7 +60,7 @@ public void IsInvertableTest() public void ElementsTest1() { ColorMatrix m1 = ColorMatrix.Identity; - ColorMatrix m2 = new ColorMatrix(0.5, 0.5, 0.5, 1, 0, 0, 0); + ColorMatrix m2 = new ColorMatrix(0.5, 0.5, 0.5, 1, 0, 0, 0, 0); Assert.AreEqual(5, m1.RowCount); Assert.AreEqual(5, m2.ColumnCount); @@ -74,42 +74,43 @@ public void ElementsTest1() new DoubleComponent[] {0, 0, 0, 0, 1} }; - DoubleComponent[][] actual = m2.Elements; + //DoubleComponent[][] actual = m2.Elements; - Assert.AreEqual(expected[0][0], actual[0][0]); - Assert.AreEqual(expected[0][1], actual[0][1]); - Assert.AreEqual(expected[0][2], actual[0][2]); - Assert.AreEqual(expected[1][0], actual[1][0]); - Assert.AreEqual(expected[1][1], actual[1][1]); - Assert.AreEqual(expected[1][2], actual[1][2]); - Assert.AreEqual(expected[2][0], actual[2][0]); - Assert.AreEqual(expected[2][1], actual[2][1]); - Assert.AreEqual(expected[2][2], actual[2][2]); + Assert.AreEqual(expected[0][0], m2[0, 0]); + Assert.AreEqual(expected[0][1], m2[0, 1]); + Assert.AreEqual(expected[0][2], m2[0, 2]); + Assert.AreEqual(expected[1][0], m2[1, 0]); + Assert.AreEqual(expected[1][1], m2[1, 1]); + Assert.AreEqual(expected[1][2], m2[1, 2]); + Assert.AreEqual(expected[2][0], m2[2, 0]); + Assert.AreEqual(expected[2][1], m2[2, 1]); + Assert.AreEqual(expected[2][2], m2[2, 2]); - m1.Elements = expected; + //m1.Elements = expected; + m1 = new ColorMatrix(new Matrix(MatrixFormat.RowMajor, expected)); Assert.AreEqual(m1, m2); Assert.IsTrue(m1.Equals(m2 as IMatrix)); } - [Test] - [ExpectedException(typeof (ArgumentNullException))] - public void ElementsTest2() - { - ColorMatrix m1 = ColorMatrix.Identity; - m1.Elements = null; - } - - [Test] - [ExpectedException(typeof (ArgumentException))] - public void ElementsTest3() - { - ColorMatrix m1 = ColorMatrix.Identity; - m1.Elements = new DoubleComponent[][] - { - new DoubleComponent[] {1, 2, 3}, - new DoubleComponent[] {2, 3, 4} - }; - } + //[Test] + //[ExpectedException(typeof (ArgumentNullException))] + //public void ElementsTest2() + //{ + // ColorMatrix m1 = ColorMatrix.Identity; + // m1.Elements = null; + //} + + //[Test] + //[ExpectedException(typeof (ArgumentException))] + //public void ElementsTest3() + //{ + // ColorMatrix m1 = ColorMatrix.Identity; + // m1.Elements = new DoubleComponent[][] + // { + // new DoubleComponent[] {1, 2, 3}, + // new DoubleComponent[] {2, 3, 4} + // }; + //} [Test] [Ignore("Test not yet implemented")] @@ -122,7 +123,7 @@ public void MultiplyTest() [Ignore("Test not yet implemented")] public void ScaleTest1() { - ColorMatrix m1 = new ColorMatrix(0, 0, 0, 0, 0, 0, 0); + ColorMatrix m1 = new ColorMatrix(0, 0, 0, 0, 0, 0, 0, 0); ColorMatrix m2 = ColorMatrix.Identity; } @@ -164,7 +165,23 @@ public void Transform2Test2() ColorMatrix m1 = ColorMatrix.Identity; // Scale by a vector for which multiplicatio isn't defined... } - } - #endregion + [Test] + public void ConstructorInitializedPropertiesTest() + { + ColorMatrix m1 = new ColorMatrix(2, 3, 4, 5, 6, 7, 8, 9); + + Assert.AreEqual(2, m1.R); + Assert.AreEqual(3, m1.G); + Assert.AreEqual(4, m1.B); + Assert.AreEqual(5, m1.A); + Assert.AreEqual(6, m1.RedShift); + Assert.AreEqual(7, m1.GreenShift); + Assert.AreEqual(8, m1.BlueShift); + Assert.AreEqual(9, m1.AlphaShift); + } + + } + + #endregion } \ No newline at end of file diff --git a/SharpMap.Tests/Rendering/Matrix2DTests.cs b/SharpMap.Tests/Rendering/Matrix2DTests.cs index ad22d76d..bc023ad5 100644 --- a/SharpMap.Tests/Rendering/Matrix2DTests.cs +++ b/SharpMap.Tests/Rendering/Matrix2DTests.cs @@ -74,38 +74,37 @@ public void ElementsTest1() new DoubleComponent[] {2, 5, 0}, new DoubleComponent[] {3, 6, 1} }; - DoubleComponent[][] actual = m3.Elements; - - Assert.AreEqual(expected[0][0], actual[0][0]); - Assert.AreEqual(expected[0][1], actual[0][1]); - Assert.AreEqual(expected[0][2], actual[0][2]); - Assert.AreEqual(expected[1][0], actual[1][0]); - Assert.AreEqual(expected[1][1], actual[1][1]); - Assert.AreEqual(expected[1][2], actual[1][2]); - Assert.AreEqual(expected[2][0], actual[2][0]); - Assert.AreEqual(expected[2][1], actual[2][1]); - Assert.AreEqual(expected[2][2], actual[2][2]); - - m1.Elements = expected; + + Assert.AreEqual(expected[0][0], m3[0, 0]); + Assert.AreEqual(expected[0][1], m3[0, 1]); + Assert.AreEqual(expected[0][2], m3[0, 2]); + Assert.AreEqual(expected[1][0], m3[1, 0]); + Assert.AreEqual(expected[1][1], m3[1, 1]); + Assert.AreEqual(expected[1][2], m3[1, 2]); + Assert.AreEqual(expected[2][0], m3[2, 0]); + Assert.AreEqual(expected[2][1], m3[2, 1]); + Assert.AreEqual(expected[2][2], m3[2, 2]); + + //m1.Elements = expected; Assert.AreEqual(m1, m3); Assert.IsTrue(m1.Equals(m3 as IMatrixD)); } - [Test] - [ExpectedException(typeof (ArgumentNullException))] - public void ElementsTest2() - { - Matrix2D m1 = Matrix2D.Identity; - m1.Elements = null; - } - - [Test] - [ExpectedException(typeof (ArgumentException))] - public void ElementsTest3() - { - Matrix2D m1 = Matrix2D.Identity; - m1.Elements = new DoubleComponent[][] {new DoubleComponent[] {1, 2, 3}, new DoubleComponent[] {2, 3, 4}}; - } + //[Test] + //[ExpectedException(typeof (ArgumentNullException))] + //public void ElementsTest2() + //{ + // Matrix2D m1 = Matrix2D.Identity; + // m1.Elements = null; + //} + + //[Test] + //[ExpectedException(typeof (ArgumentException))] + //public void ElementsTest3() + //{ + // Matrix2D m1 = Matrix2D.Identity; + // m1.Elements = new DoubleComponent[][] {new DoubleComponent[] {1, 2, 3}, new DoubleComponent[] {2, 3, 4}}; + //} [Test] [Ignore("Test not yet implemented")] diff --git a/SharpMap.Tests/Rendering/Rectangle2DTests.cs b/SharpMap.Tests/Rendering/Rectangle2DTests.cs index eb52c65d..71cbff2e 100644 --- a/SharpMap.Tests/Rendering/Rectangle2DTests.cs +++ b/SharpMap.Tests/Rendering/Rectangle2DTests.cs @@ -196,7 +196,7 @@ public void ScaleTest1() [ExpectedException(typeof (ArgumentException))] public void ScaleTest2() { - ViewSize3D scaleSize = new ViewSize3D(10, 10, 10); + Size3D scaleSize = new Size3D(10, 10, 10); Rectangle2D r2 = Rectangle2D.Zero; r2.Scale(scaleSize); } @@ -224,7 +224,7 @@ public void TranslateTest1() public void TranslateTest2() { Rectangle2D r1 = Rectangle2D.Zero; - r1.Translate(new ViewPoint3D(3, 4, 5)); + r1.Translate(new Point3D(3, 4, 5)); } [Test] diff --git a/SharpMap.Tests/SharpMap.Tests.csproj b/SharpMap.Tests/SharpMap.Tests.csproj index 2f742ced..39683dab 100644 --- a/SharpMap.Tests/SharpMap.Tests.csproj +++ b/SharpMap.Tests/SharpMap.Tests.csproj @@ -79,6 +79,18 @@ {FFB69466-79DE-466A-ADA7-5C47C5C5CA3A} GeoAPINoTFS + + {E028BDD2-55E1-4E5F-BE31-35FAEC8D6428} + ProjNet + + + {7F258589-6452-4B7B-8884-8965A42C1D9E} + SharpMap.SimpleGeometries + + + {C83777FC-AABB-47D9-911F-D76255D4D541} + SharpMap + @@ -129,11 +141,6 @@ - - - - - @@ -141,7 +148,6 @@ - @@ -161,12 +167,6 @@ - - - {C83777FC-AABB-47D9-911F-D76255D4D541} - SharpMap - - PreserveNewest @@ -175,6 +175,9 @@ + + +