コード例 #1
0
        /**
         * Constructs a new filter for converting features into geometry.
         */
        public BuildGeomFilter()
        {
            overall_color = new Vector4D(1, 1, 1, 1);
            setRasterOverlayMaxSize(DEFAULT_RASTER_OVERLAY_MAX_SIZE);

            //DefineResources();
            //InitializeResources();
        }
コード例 #2
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Adds a vector and a scalar.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="scalar">A double-precision floating-point number.</param>
		/// <returns>A new <see cref="Vector4D"/> instance containing the sum.</returns>
		public static Vector4D Add(Vector4D vector, double scalar)
		{
			return new Vector4D(vector.X + scalar, vector.Y + scalar, vector.Z + scalar, vector.W + scalar);
		}
コード例 #3
0
ファイル: Matrix4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Transforms a given vector by a matrix.
		/// </summary>
		/// <param name="matrix">A <see cref="Matrix4D"/> instance.</param>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <returns>A new <see cref="Vector4D"/> instance containing the result.</returns>
		public static Vector4D Transform(Matrix4D matrix, Vector4D vector)
		{
			return new Vector4D(
				(matrix.M11 * vector.X) + (matrix.M12 * vector.Y) + (matrix.M13 * vector.Z) + (matrix.M14 * vector.W),
				(matrix.M21 * vector.X) + (matrix.M22 * vector.Y) + (matrix.M23 * vector.Z) + (matrix.M24 * vector.W),
				(matrix.M31 * vector.X) + (matrix.M32 * vector.Y) + (matrix.M33 * vector.Z) + (matrix.M34 * vector.W),
				(matrix.M41 * vector.X) + (matrix.M42 * vector.Y) + (matrix.M43 * vector.Z) + (matrix.M44 * vector.W));
		}
コード例 #4
0
 /// <summary>
 /// Adds a vector and a scalar.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <param name="scalar">A double-precision floating-point number.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the sum.</returns>
 public static Vector4D operator +(double scalar, Vector4D vector)
 {
     return(Vector4D.Add(vector, scalar));
 }
コード例 #5
0
 /// <summary>
 /// Multiplies a vector by a scalar.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <param name="scalar">A double-precision floating-point number.</param>
 /// <returns>A new <see cref="Vector4D"/> containing the result.</returns>
 public static Vector4D operator *(double scalar, Vector4D vector)
 {
     return(Vector4D.Multiply(vector, scalar));
 }
コード例 #6
0
 /// <summary>
 /// Divides a vector by a scalar.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <param name="scalar">A scalar</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = vector[i] / scalar;
 /// </remarks>
 public static Vector4D Divide(Vector4D vector, double scalar)
 {
     return(new Vector4D(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar));
 }
コード例 #7
0
 /// <summary>
 /// Negates a vector.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the negated values.</returns>
 public static Vector4D Negate(Vector4D vector)
 {
     return(new Vector4D(-vector.X, -vector.Y, -vector.Z, -vector.W));
 }
コード例 #8
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Subtracts a vector from a second vector and puts the result into a third vector.
		/// </summary>
		/// <param name="left">A <see cref="Vector4D"/> instance.</param>
		/// <param name="right">A <see cref="Vector4D"/> instance</param>
		/// <param name="result">A <see cref="Vector4D"/> instance to hold the result.</param>
		/// <remarks>
		///	result[i] = left[i] - right[i].
		/// </remarks>
		public static void Subtract(Vector4D left, Vector4D right, ref Vector4D result)
		{
			result.X = left.X - right.X;
			result.Y = left.Y - right.Y;
			result.Z = left.Z - right.Z;
			result.W = left.W - right.W;
		}
コード例 #9
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Subtracts a vector from a scalar and put the result into another vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="scalar">A double-precision floating-point number.</param>
		/// <param name="result">A <see cref="Vector4D"/> instance to hold the result.</param>
		/// <remarks>
		/// result[i] = vector[i] - scalar
		/// </remarks>
		public static void Subtract(Vector4D vector, double scalar, ref Vector4D result)
		{
			result.X = vector.X - scalar;
			result.Y = vector.Y - scalar;
			result.Z = vector.Z - scalar;
			result.W = vector.W - scalar;
		}
コード例 #10
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Subtracts a scalar from a vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="scalar">A double-precision floating-point number.</param>
		/// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
		/// <remarks>
		/// result[i] = vector[i] - scalar
		/// </remarks>
		public static Vector4D Subtract(Vector4D vector, double scalar)
		{
			return new Vector4D(vector.X - scalar, vector.Y - scalar, vector.Z - scalar, vector.W - scalar);
		}
コード例 #11
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Subtracts a vector from a scalar.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="scalar">A double-precision floating-point number.</param>
		/// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
		/// <remarks>
		/// result[i] = scalar - vector[i]
		/// </remarks>
		public static Vector4D Subtract(double scalar, Vector4D vector)
		{
			return new Vector4D(scalar - vector.X, scalar - vector.Y, scalar - vector.Z, scalar - vector.W);
		}
コード例 #12
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Subtracts a vector from a vector.
		/// </summary>
		/// <param name="left">A <see cref="Vector4D"/> instance.</param>
		/// <param name="right">A <see cref="Vector4D"/> instance.</param>
		/// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
		/// <remarks>
		///	result[i] = left[i] - right[i].
		/// </remarks>
		public static Vector4D Subtract(Vector4D left, Vector4D right)
		{
			return new Vector4D(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W);
		}
コード例 #13
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Adds a vector and a scalar and put the result into another vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="scalar">A double-precision floating-point number.</param>
		/// <param name="result">A <see cref="Vector4D"/> instance to hold the result.</param>
		public static void Add(Vector4D vector, double scalar, ref Vector4D result)
		{
			result.X = vector.X + scalar;
			result.Y = vector.Y + scalar;
			result.Z = vector.Z + scalar;
			result.W = vector.W + scalar;
		}
コード例 #14
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Adds two vectors and put the result in the third vector.
		/// </summary>
		/// <param name="left">A <see cref="Vector4D"/> instance.</param>
		/// <param name="right">A <see cref="Vector4D"/> instance</param>
		/// <param name="result">A <see cref="Vector4D"/> instance to hold the result.</param>
		public static void Add(Vector4D left, Vector4D right, ref Vector4D result)
		{
			result.X = left.X + right.X;
			result.Y = left.Y + right.Y;
			result.Z = left.Z + right.Z;
			result.W = left.W + right.W;
		}
コード例 #15
0
 /// <summary>
 /// Subtracts a vector from a vector.
 /// </summary>
 /// <param name="left">A <see cref="Vector4D"/> instance.</param>
 /// <param name="right">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 ///	result[i] = left[i] - right[i].
 /// </remarks>
 public static Vector4D Subtract(Vector4D left, Vector4D right)
 {
     return(new Vector4D(left.X - right.X, left.Y - right.Y, left.Z - right.Z, left.W - right.W));
 }
コード例 #16
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Subtracts a scalar from a vector and put the result into another vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="scalar">A double-precision floating-point number.</param>
		/// <param name="result">A <see cref="Vector4D"/> instance to hold the result.</param>
		/// <remarks>
		/// result[i] = scalar - vector[i]
		/// </remarks>
		public static void Subtract(double scalar, Vector4D vector, ref Vector4D result)
		{
			result.X = scalar - vector.X;
			result.Y = scalar - vector.Y;
			result.Z = scalar - vector.Z;
			result.W = scalar - vector.W;
		}
コード例 #17
0
 /// <summary>
 /// Subtracts a vector from a scalar.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <param name="scalar">A double-precision floating-point number.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = scalar - vector[i]
 /// </remarks>
 public static Vector4D Subtract(double scalar, Vector4D vector)
 {
     return(new Vector4D(scalar - vector.X, scalar - vector.Y, scalar - vector.Z, scalar - vector.W));
 }
コード例 #18
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Divides a vector by another vector.
		/// </summary>
		/// <param name="left">A <see cref="Vector4D"/> instance.</param>
		/// <param name="right">A <see cref="Vector4D"/> instance.</param>
		/// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
		/// <remarks>
		///	result[i] = left[i] / right[i].
		/// </remarks>
		public static Vector4D Divide(Vector4D left, Vector4D right)
		{
			return new Vector4D(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W);
		}
コード例 #19
0
 /// <summary>
 /// Multiplies a vector by a scalar.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <param name="scalar">A double-precision floating-point number.</param>
 /// <returns>A new <see cref="Vector4D"/> containing the result.</returns>
 public static Vector4D Multiply(Vector4D vector, double scalar)
 {
     return(new Vector4D(vector.X * scalar, vector.Y * scalar, vector.Z * scalar, vector.W * scalar));
 }
コード例 #20
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Divides a vector by a scalar.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="scalar">A scalar</param>
		/// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
		/// <remarks>
		/// result[i] = vector[i] / scalar;
		/// </remarks>
		public static Vector4D Divide(Vector4D vector, double scalar)
		{
			return new Vector4D(vector.X / scalar, vector.Y / scalar, vector.Z / scalar, vector.W / scalar);
		}
コード例 #21
0
 /// <summary>
 /// Negates the values of the given vector.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the negated values.</returns>
 public static Vector4D operator -(Vector4D vector)
 {
     return(Vector4D.Negate(vector));
 }
コード例 #22
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Divides a scalar by a vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="scalar">A scalar</param>
		/// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
		/// <remarks>
		/// result[i] = scalar / vector[i]
		/// </remarks>
		public static Vector4D Divide(double scalar, Vector4D vector)
		{
			return new Vector4D(scalar / vector.X, scalar / vector.Y, scalar / vector.Z, scalar / vector.W);
		}
コード例 #23
0
 /// <summary>
 /// Subtracts a scalar from a vector.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <param name="scalar">A double-precision floating-point number.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = vector[i] - scalar
 /// </remarks>
 public static Vector4D operator -(Vector4D vector, double scalar)
 {
     return(Vector4D.Subtract(vector, scalar));
 }
コード例 #24
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Divides a vector by another vector.
		/// </summary>
		/// <param name="left">A <see cref="Vector4D"/> instance.</param>
		/// <param name="right">A <see cref="Vector4D"/> instance.</param>
		/// <param name="result">A <see cref="Vector4D"/> instance to hold the result.</param>
		/// <remarks>
		/// result[i] = left[i] / right[i]
		/// </remarks>
		public static void Divide(Vector4D left, Vector4D right, ref Vector4D result)
		{
			result.X = left.X / right.X;
			result.Y = left.Y / right.Y;
			result.Z = left.Z / right.Z;
			result.W = left.W / right.W;
		}
コード例 #25
0
 /// <summary>
 /// Divides a scalar by a vector.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <param name="scalar">A scalar</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = scalar / vector[i]
 /// </remarks>
 public static Vector4D operator /(double scalar, Vector4D vector)
 {
     return(Vector4D.Divide(scalar, vector));
 }
コード例 #26
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Divides a vector by a scalar.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="scalar">A scalar</param>
		/// <param name="result">A <see cref="Vector4D"/> instance to hold the result.</param>
		/// <remarks>
		/// result[i] = vector[i] / scalar
		/// </remarks>
		public static void Divide(Vector4D vector, double scalar, ref Vector4D result)
		{
			result.X = vector.X / scalar;
			result.Y = vector.Y / scalar;
			result.Z = vector.Z / scalar;
			result.W = vector.W / scalar;
		}
コード例 #27
0
        // FragmentFilter overrides
        public override FragmentList process(FeatureList input, FilterEnv env)
        {
            FragmentList output = new FragmentList();

            //cuidado con las entidades dentro del for

            int i = 0;
            Vector3 scale;
            Vector3 distanceScale;
            Vector3 mScale = new Vector3 (1,1,1);
            float lWidth = 1;

            if (Scale != null)
            {
                scale = Registry.instance().GetEngine("Python").run(Scale).asVec3();
            }
            else
            {
                scale = new Vector3(1, 1, 1);
            }

            if (CoordScale != null)
            {
                distanceScale = Registry.instance().GetEngine("Python").run(CoordScale).asVec3();
            }
            else
            {
                distanceScale = new Vector3(1, 1, 1);
            }
            if (LineWidth != null)
            {
                lWidth = Registry.instance().GetEngine("Python").run(LineWidth).asFloat();
            }
            if (MaterialScale != null)
            {
                mScale = Registry.instance().GetEngine("Python").run(MaterialScale).asVec3();
            }

            SceneNode nodeIni = point3d(env.getName(), i, 0, 0, 0, null, env.getSceneMgr());
            #if ESCALA_NODO_INICIAL
            if (Scale != null)
            {
                nodeIni.SetScale(Registry.instance().GetEngine("Python").run(Scale).asVec3());
            }
            if (coordScale != null)
            {
                Vector3 vec3 = Registry.instance().GetEngine("Python").run(Scale).asVec3();
                nodeIni.SetPosition(nodeIni.Position.x * vec3.x, nodeIni.Position.y * vec3.y, nodeIni.Position.z * vec3.z);
            #if TRACE_BUILDGEOMFILTER
                        System.Console.WriteLine("(" + n.Position.x + "," + n.Position.y + ")");
            #endif
            }
            #endif
            Fragment fIni = new Fragment(nodeIni);
            output.Add(fIni);

            foreach (Feature feature in input)
            {
                //if type of features is Point
                if (feature.row.Geometry is SharpMap.Geometries.Point)
                {
                    SharpMap.Geometries.Point p = (SharpMap.Geometries.Point)feature.row.Geometry;

                    i++;
                    SceneNode n = point3d(env.getName(), i, (float)p.X, (float)p.Y, 0, nodeIni, env.getSceneMgr());

                    n.SetScale(scale);
                    n.SetPosition(n.Position.x * distanceScale.x, n.Position.y * distanceScale.y, n.Position.z * distanceScale.z);

                    Fragment f = new Fragment(n);
                    output.Add(f);
                }

                //if type of features is Polygon
                else if (feature.row.Geometry is SharpMap.Geometries.Polygon)
                {
                    SharpMap.Geometries.Polygon polygon = (SharpMap.Geometries.Polygon)feature.row.Geometry;

                    ManualObject polygonNode = null;

                    if (polygonNode == null)
                    {
                        polygonNode = env.getSceneMgr().CreateManualObject(env.getName() + "Node_" + i);
                        MaterialPtr material = MaterialManager.Singleton.Create("Test/ColourPolygon",
                                     ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                        material.GetTechnique(0).GetPass(0).VertexColourTracking =
                                       (int)TrackVertexColourEnum.TVC_AMBIENT;

                        //Vector3 v = Registry.instance().GetEngine("Python").run(Color, feature, null).asVec3();
                        MogreTessellationCallbacks callback = new MogreTessellationCallbacks(polygonNode, Color, feature);

                        if (nameMaterial != null)
                        {
                            callback.Material = nameMaterial; // "Test/ColourPolygon2";
                            callback.MaterialScale = mScale;
                        }

                        GLUtessellatorImpl Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
                        Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
                        Glu.gluTessBeginPolygon(null);
                        Glu.gluTessBeginContour();

                        int numVertices = polygon.ExteriorRing.NumPoints/*/10+1*/;
                        int numValores = 3;
                        double[][] data = new double[numVertices][];

                        for (int j = 0; j < numVertices; j++)
                        {
                            data[j] = new double[numValores];
                        }

                        int k = 0;
                        //1 polygon = N vertices
                        foreach (SharpMap.Geometries.Point point in polygon.ExteriorRing.Vertices)
                        {
                            //if (k % 10 == 0)
                            {
                                data[k/*/10*/][0] = point.X;
                                data[k/*/10*/][1] = point.Y;
                                data[k/*/10*/][2] = 0;
                            }
                            k++;

                            //SceneNode n = point3d(env.getName()+i+k, k + 10, (float)point.X * 10.0f, (float)point.Y * 10.0f, 0, nodeIni, env.getSceneMgr());

                        }
                        for (int j = 0; j < data.GetLength(0); j++)
                        {
                            Glu.gluTessVertex(data[j], 0, new Vector3((float)(data[j][1] * distanceScale.y), (float)(data[j][2] * distanceScale.z), (float)(data[j][0] * distanceScale.x)));
                        }

                        Glu.gluTessEndContour();
                        Glu.gluTessNormal(0, 0, 1);
                        Glu.gluTessEndPolygon();

                        nodeIni.AttachObject(polygonNode);

                    }
                    i++;
                }

                //if type of features is MultiPolygon
                else if (feature.row.Geometry is SharpMap.Geometries.MultiPolygon)
                {
                    SharpMap.Geometries.MultiPolygon mp = (SharpMap.Geometries.MultiPolygon)feature.row.Geometry;

                    // 1 MultiPolygon = N polygon
                    foreach (SharpMap.Geometries.Polygon polygon in mp.Polygons)
                    {

                        ManualObject polygonNode = null;

                        if (polygonNode == null)
                        {
                            polygonNode = env.getSceneMgr().CreateManualObject(env.getName() + "Node_" + i);
                            MaterialPtr material = MaterialManager.Singleton.Create("Test/ColourPolygon",
                                     ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                            material.GetTechnique(0).GetPass(0).VertexColourTracking =
                                           (int)TrackVertexColourEnum.TVC_AMBIENT;

                            //Vector3 v = Registry.instance().GetEngine("Python").run(Color, feature, null).asVec3();
                            MogreTessellationCallbacks callback = new MogreTessellationCallbacks(polygonNode, Color, feature);

                            if (nameMaterial != null)
                            {
                                callback.Material = nameMaterial; // "Test/ColourPolygon2";
                                callback.MaterialScale = mScale;
                            }

                            GLUtessellatorImpl Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
                            Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
                            Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
                            Glu.gluTessBeginPolygon(null);
                            Glu.gluTessBeginContour();

                            int numVertices = polygon.ExteriorRing.NumPoints;
                            int numValores = 3;
                            double[][] data = new double[numVertices][];

                            for (int j = 0; j < numVertices; j++)
                            {
                                data[j] = new double[numValores];
                            }

                            int k = 0;
                            //1 polygon = N vertices
                            foreach (SharpMap.Geometries.Point point in polygon.ExteriorRing.Vertices)
                            {

                                data[k][0] = point.X;
                                data[k][1] = point.Y;
                                data[k][2] = 0;

                                k++;

                                //SceneNode n = point3d(env.getName(), i, (float)point.X, (float)point.Y, 0, nodeIni, env.getSceneMgr());

                            }
                            for (int j = 0; j < data.GetLength(0); j++)
                            {
                                Glu.gluTessVertex(data[j], 0, new Vector3(((float)data[j][1]) * distanceScale.y, ((float)data[j][2]) * distanceScale.z, ((float)data[j][0]) * distanceScale.x));
                            }

                            Glu.gluTessEndContour();
                            Glu.gluTessNormal(0, 0, 1);
                            Glu.gluTessEndPolygon();

                            nodeIni.AttachObject(polygonNode);

                        }
                        i++;
                    }
                }

                //if type of features is Line
                else if (feature.row.Geometry is SharpMap.Geometries.ILineal/*SharpMap.Geometries.LineString*/)
                {
                    System.Collections.Generic.List<SharpMap.Geometries.ILineal> lineas = new System.Collections.Generic.List<SharpMap.Geometries.ILineal>();
                    if (feature.row.Geometry is SharpMap.Geometries.MultiLineString)
                    {
                        foreach (SharpMap.Geometries.LineString l in ((SharpMap.Geometries.MultiLineString)(feature.row.Geometry)).LineStrings)
                        {
                            lineas.Add(l);
                        }
                    }
                    else
                    {
                        lineas.Add((SharpMap.Geometries.ILineal)(feature.row.Geometry));
                    }
                    foreach (SharpMap.Geometries.ILineal line in lineas)
                    {
                        ManualObject lineNode = env.getSceneMgr().CreateManualObject("line" + i);

                        //MaterialPtr material = MaterialManager.Singleton.Create(nameMaterial,
                        //ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME);
                        //material.GetTechnique(0).GetPass(0).VertexColourTracking =
                        //               (int)TrackVertexColourEnum.TVC_AMBIENT;
                        //material.GetTechnique(0).GetPass(0).SetDepthBias(100);
                        //material.GetTechnique(0).GetPass(0).LightingEnabled = false;

                        int nSeg = 5; // Number of segments on the cap or join pieces
                        BufferParameters param = new BufferParameters(nSeg, BufferParameters.BufferEndCapStyle.CapRound, BufferParameters.BufferJoinStyle.JoinRound, 2);
                        IGeometryFactory<Coord> geometryFactory = new GeometryFactory<Coord>(new CoordSeqFac(new CoordFac(PrecisionModelType.DoubleFloating)));
                        //IWktGeometryReader<Coord> reader = geometryFactory.WktReader;
                        //string txt = feature.row.Geometry.AsText();
                        ILineString line1 = (ILineString)GeometryConverter.ToNTSGeometry((SharpMap.Geometries.LineString)line, geometryFactory); // (ILineString<Coord>)reader.Read(txt);
                        IGeometry coordBuffer = line1.Buffer(lWidth, param);
                        ICoordinateSequence coords = coordBuffer.Coordinates;
                        //Vector3 v = Registry.instance().GetEngine("Python").run(Color, feature, null).asVec3();
                        MogreTessellationCallbacks callback = new MogreTessellationCallbacks(lineNode, Color, feature);
                        if (nameMaterial != null)
                        {
                            callback.Material = nameMaterial; // "Test/ColourPolygon2";
                            callback.MaterialScale = mScale;
                        }

                        GLUtessellatorImpl Glu = (GLUtessellatorImpl)GLUtessellatorImpl.gluNewTess();
                        Glu.gluTessCallback(GLU.GLU_TESS_VERTEX, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_BEGIN, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_END, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_ERROR, callback);
                        Glu.gluTessCallback(GLU.GLU_TESS_COMBINE, callback);
                        Glu.gluTessBeginPolygon(null);
                        Glu.gluTessBeginContour();
                        foreach (Coord coord in coords)
                        {
                            double[] data = new double[] { coord.X * distanceScale.x, coord.Y * distanceScale.y, (double.IsNaN(coord.Z) ? 0 : coord.Z) * distanceScale.z };

                            Glu.gluTessVertex(data, 0, new Vector3((float)data[1], (float)data[2], (float)data[0]));
                        }
                        Glu.gluTessEndContour();
                        Glu.gluTessNormal(0, 0, 1);
                        Glu.gluTessEndPolygon();
                        i++;
                        nodeIni.AttachObject(lineNode);
                    }
                    if ((feature.row.Geometry is SharpMap.Geometries.Polygon) | (feature.row.Geometry is SharpMap.Geometries.MultiPolygon))
                    {
                        Fragment f = new Fragment(nodeIni);
                        output.Add(f);
                    }

                }
            }
            i = 0;//breakpoint

            /*foreach (Fragment fragment in output)
            {
                fragment.Node.Scale(0,0,0);
            }*/

            #if TODO
            // if features are arriving in batch, resolve the color here.
            // otherwise we will resolve it later in process(feature,env).
            is_batch = input.Count > 1;
            batch_feature_color = overall_color;
            if (is_batch && getColorScript() != null)
            {
                ScriptResult r = env.getScriptEngine().run(getColorScript(), env);
                if (r.isValid())
                    batch_feature_color = r.asVec4();
                else
                    env.getReport().error(r.asString());
            }

            return base.process(input, env);
            #endif
            //throw new NotImplementedException();

            if (successor != null)
            {
                if (successor is FeatureFilter)
                {
                    FeatureFilter filter = (FeatureFilter)successor;
                    FeatureList l = filter.process(input, env);
                    //FeatureList l = successor.process(input, env);
                }
                else if (successor is FragmentFilter)
                {
                    FragmentFilter filter = (FragmentFilter)successor;
                    FragmentList l = filter.process(output, env);
                }
            }

            return output;
        }
コード例 #28
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Divides a scalar by a vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="scalar">A scalar</param>
		/// <param name="result">A <see cref="Vector4D"/> instance to hold the result.</param>
		/// <remarks>
		/// result[i] = scalar / vector[i]
		/// </remarks>
		public static void Divide(double scalar, Vector4D vector, ref Vector4D result)
		{
			result.X = scalar / vector.X;
			result.Y = scalar / vector.Y;
			result.Z = scalar / vector.Z;
			result.W = scalar / vector.W;
		}
コード例 #29
0
ファイル: Transform3D.cs プロジェクト: ddanninger/PLMPack
        public Vector3D transform(Vector3D vec)
        {
            Vector4D vecTransf = _mat * (new Vector4D(vec.X, vec.Y, vec.Z, 1.0));

            return(new Vector3D(vecTransf.X, vecTransf.Y, vecTransf.Z));
        }
コード例 #30
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Multiplies a vector by a scalar.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="scalar">A double-precision floating-point number.</param>
		/// <returns>A new <see cref="Vector4D"/> containing the result.</returns>
		public static Vector4D Multiply(Vector4D vector, double scalar)
		{
			return new Vector4D(vector.X * scalar, vector.Y * scalar, vector.Z * scalar, vector.W * scalar);
		}
コード例 #31
0
 /// <summary>
 /// Adds a vector and a scalar.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <param name="scalar">A double-precision floating-point number.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the sum.</returns>
 public static Vector4D Add(Vector4D vector, double scalar)
 {
     return(new Vector4D(vector.X + scalar, vector.Y + scalar, vector.Z + scalar, vector.W + scalar));
 }
コード例 #32
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Multiplies a vector by a scalar and put the result in another vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="scalar">A double-precision floating-point number.</param>
		/// <param name="result">A <see cref="Vector4D"/> instance to hold the result.</param>
		public static void Multiply(Vector4D vector, double scalar, ref Vector4D result)
		{
			result.X = vector.X * scalar;
			result.Y = vector.Y * scalar;
			result.Z = vector.Z * scalar;
			result.W = vector.W * scalar;
		}
コード例 #33
0
 /// <summary>
 /// Subtracts a scalar from a vector.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <param name="scalar">A double-precision floating-point number.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = vector[i] - scalar
 /// </remarks>
 public static Vector4D Subtract(Vector4D vector, double scalar)
 {
     return(new Vector4D(vector.X - scalar, vector.Y - scalar, vector.Z - scalar, vector.W - scalar));
 }
コード例 #34
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Calculates the dot product of two vectors.
		/// </summary>
		/// <param name="left">A <see cref="Vector4D"/> instance.</param>
		/// <param name="right">A <see cref="Vector4D"/> instance.</param>
		/// <returns>The dot product value.</returns>
		public static double DotProduct(Vector4D left, Vector4D right)
		{
			return (left.X * right.X) + (left.Y * right.Y) + (left.Z * right.Z) + (left.W * right.W);
		}
コード例 #35
0
 /// <summary>
 /// Divides a vector by another vector.
 /// </summary>
 /// <param name="left">A <see cref="Vector4D"/> instance.</param>
 /// <param name="right">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 ///	result[i] = left[i] / right[i].
 /// </remarks>
 public static Vector4D Divide(Vector4D left, Vector4D right)
 {
     return(new Vector4D(left.X / right.X, left.Y / right.Y, left.Z / right.Z, left.W / right.W));
 }
コード例 #36
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Negates a vector.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <returns>A new <see cref="Vector4D"/> instance containing the negated values.</returns>
		public static Vector4D Negate(Vector4D vector)
		{
			return new Vector4D(-vector.X, -vector.Y, -vector.Z, -vector.W);
		}
コード例 #37
0
 /// <summary>
 /// Divides a scalar by a vector.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <param name="scalar">A scalar</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = scalar / vector[i]
 /// </remarks>
 public static Vector4D Divide(double scalar, Vector4D vector)
 {
     return(new Vector4D(scalar / vector.X, scalar / vector.Y, scalar / vector.Z, scalar / vector.W));
 }
コード例 #38
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Tests whether two vectors are approximately equal using default tolerance value.
		/// </summary>
		/// <param name="left">A <see cref="Vector4D"/> instance.</param>
		/// <param name="right">A <see cref="Vector4D"/> instance.</param>
		/// <returns><see langword="true"/> if the two vectors are approximately equal; otherwise, <see langword="false"/>.</returns>
		public static bool ApproxEqual(Vector4D left, Vector4D right)
		{
			return ApproxEqual(left, right, MathFunctions.EpsilonD);
		}
コード例 #39
0
 /// <summary>
 /// Calculates the dot product of two vectors.
 /// </summary>
 /// <param name="left">A <see cref="Vector4D"/> instance.</param>
 /// <param name="right">A <see cref="Vector4D"/> instance.</param>
 /// <returns>The dot product value.</returns>
 public static double DotProduct(Vector4D left, Vector4D right)
 {
     return((left.X * right.X) + (left.Y * right.Y) + (left.Z * right.Z) + (left.W * right.W));
 }
コード例 #40
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Tests whether two vectors are approximately equal given a tolerance value.
		/// </summary>
		/// <param name="left">A <see cref="Vector4D"/> instance.</param>
		/// <param name="right">A <see cref="Vector4D"/> instance.</param>
		/// <param name="tolerance">The tolerance value used to test approximate equality.</param>
		/// <returns><see langword="true"/> if the two vectors are approximately equal; otherwise, <see langword="false"/>.</returns>
		public static bool ApproxEqual(Vector4D left, Vector4D right, double tolerance)
		{
			return
				(
				(System.Math.Abs(left.X - right.X) <= tolerance) &&
				(System.Math.Abs(left.Y - right.Y) <= tolerance) &&
				(System.Math.Abs(left.Z - right.Z) <= tolerance) &&
				(System.Math.Abs(left.W - right.W) <= tolerance)
				);
		}
コード例 #41
0
 /// <summary>
 /// Tests whether two vectors are approximately equal using default tolerance value.
 /// </summary>
 /// <param name="left">A <see cref="Vector4D"/> instance.</param>
 /// <param name="right">A <see cref="Vector4D"/> instance.</param>
 /// <returns><see langword="true"/> if the two vectors are approximately equal; otherwise, <see langword="false"/>.</returns>
 public static bool ApproxEqual(Vector4D left, Vector4D right)
 {
     return(ApproxEqual(left, right, MathFunctions.EpsilonD));
 }
コード例 #42
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Initializes a new instance of the <see cref="Vector4D"/> class using coordinates from a given <see cref="Vector4D"/> instance.
		/// </summary>
		/// <param name="vector">A <see cref="Vector4D"/> to get the coordinates from.</param>
		public Vector4D(Vector4D vector)
		{
			_x = vector.X;
			_y = vector.Y;
			_z = vector.Z;
			_w = vector.W;
		}
コード例 #43
0
 /// <summary>
 /// Adds two vectors.
 /// </summary>
 /// <param name="left">A <see cref="Vector4D"/> instance.</param>
 /// <param name="right">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the sum.</returns>
 public static Vector4D operator +(Vector4D left, Vector4D right)
 {
     return(Vector4D.Add(left, right));
 }
コード例 #44
0
 /// <summary>
 /// Subtracts a vector from a vector.
 /// </summary>
 /// <param name="u">A <see cref="Vector4D"/> instance.</param>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 ///	result[i] = v[i] - w[i].
 /// </remarks>
 public static Vector4D operator -(Vector4D u, Vector4D v)
 {
     return(Vector4D.Subtract(u, v));
 }
コード例 #45
0
 /// <summary>
 /// Subtracts a vector from a vector.
 /// </summary>
 /// <param name="left">A <see cref="Vector4D"/> instance.</param>
 /// <param name="right">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 ///	result[i] = left[i] - right[i].
 /// </remarks>
 public static Vector4D operator -(Vector4D left, Vector4D right)
 {
     return(Vector4D.Subtract(left, right));
 }
コード例 #46
0
 /// <summary>
 /// Subtracts a scalar from a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = v[i] - s
 /// </remarks>
 public static Vector4D operator -(Vector4D v, double s)
 {
     return(Vector4D.Subtract(v, s));
 }
コード例 #47
0
 /// <summary>
 /// Subtracts a vector from a scalar.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <param name="scalar">A double-precision floating-point number.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = scalar - vector[i]
 /// </remarks>
 public static Vector4D operator -(double scalar, Vector4D vector)
 {
     return(Vector4D.Subtract(scalar, vector));
 }
コード例 #48
0
 /// <summary>
 /// Subtracts a vector from a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the difference.</returns>
 /// <remarks>
 /// result[i] = s - v[i]
 /// </remarks>
 public static Vector4D operator -(double s, Vector4D v)
 {
     return(Vector4D.Subtract(s, v));
 }
コード例 #49
0
 /// <summary>
 /// Divides a vector by a scalar.
 /// </summary>
 /// <param name="vector">A <see cref="Vector4D"/> instance.</param>
 /// <param name="scalar">A scalar</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = vector[i] / scalar;
 /// </remarks>
 public static Vector4D operator /(Vector4D vector, double scalar)
 {
     return(Vector4D.Divide(vector, scalar));
 }
コード例 #50
0
 /// <summary>
 /// Multiplies a vector by a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar.</param>
 /// <returns>A new <see cref="Vector4D"/> containing the result.</returns>
 public static Vector4D operator *(double s, Vector4D v)
 {
     return(Vector4D.Multiply(v, s));
 }
コード例 #51
0
ファイル: Matrix4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Initializes a new instance of the <see cref="Matrix4D"/> structure with the specified values.
		/// </summary>
		/// <param name="column1">A <see cref="Vector4D"/> instance holding values for the first column.</param>
		/// <param name="column2">A <see cref="Vector4D"/> instance holding values for the second column.</param>
		/// <param name="column3">A <see cref="Vector4D"/> instance holding values for the third column.</param>
		/// <param name="column4">A <see cref="Vector4D"/> instance holding values for the fourth column.</param>
		public Matrix4D(Vector4D column1, Vector4D column2, Vector4D column3, Vector4D column4)
		{
			_m11 = column1.X; _m12 = column2.X; _m13 = column3.X; _m14 = column4.X;
			_m21 = column1.Y; _m22 = column2.Y; _m23 = column3.Y; _m24 = column4.Y;
			_m31 = column1.Z; _m32 = column2.Z; _m33 = column3.Z; _m34 = column4.Z;
			_m41 = column1.W; _m42 = column2.W; _m43 = column3.W; _m44 = column4.W;
		}
コード例 #52
0
 /// <summary>
 /// Divides a vector by a scalar.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = v[i] / s;
 /// </remarks>
 public static Vector4D operator /(Vector4D v, double s)
 {
     return(Vector4D.Divide(v, s));
 }
コード例 #53
0
ファイル: Matrix4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Transforms a given vector by a matrix and put the result in a vector.
		/// </summary>
		/// <param name="matrix">A <see cref="Matrix4D"/> instance.</param>
		/// <param name="vector">A <see cref="Vector4D"/> instance.</param>
		/// <param name="result">A <see cref="Vector4D"/> instance to hold the result.</param>
		public static void Transform(Matrix4D matrix, Vector4D vector, ref Vector4D result)
		{
			result.X = (matrix.M11 * vector.X) + (matrix.M12 * vector.Y) + (matrix.M13 * vector.Z) + (matrix.M14 * vector.W);
			result.Y = (matrix.M21 * vector.X) + (matrix.M22 * vector.Y) + (matrix.M23 * vector.Z) + (matrix.M24 * vector.W);
			result.Z = (matrix.M31 * vector.X) + (matrix.M32 * vector.Y) + (matrix.M33 * vector.Z) + (matrix.M34 * vector.W);
			result.W = (matrix.M41 * vector.X) + (matrix.M42 * vector.Y) + (matrix.M43 * vector.Z) + (matrix.M44 * vector.W);
		}
コード例 #54
0
 /// <summary>
 /// Divides a scalar by a vector.
 /// </summary>
 /// <param name="v">A <see cref="Vector4D"/> instance.</param>
 /// <param name="s">A scalar</param>
 /// <returns>A new <see cref="Vector4D"/> containing the quotient.</returns>
 /// <remarks>
 /// result[i] = s / v[i]
 /// </remarks>
 public static Vector4D operator /(double s, Vector4D v)
 {
     return(Vector4D.Divide(s, v));
 }
コード例 #55
0
 //properties
 /**
  * Sets the overall color to assign to generated primitives.
  *
  * @param color
  *      A Vec4 color
  */
 public void setColor(Vector4D _color)
 {
     overall_color = _color;
 }
コード例 #56
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Matrix3D"/> structure with the specified values.
 /// </summary>
 /// <param name="column1">A <see cref="Vector2D"/> instance holding values for the first column.</param>
 /// <param name="column2">A <see cref="Vector2D"/> instance holding values for the second column.</param>
 /// <param name="column3">A <see cref="Vector2D"/> instance holding values for the third column.</param>
 public Matrix3D(Vector4D column1, Vector4D column2, Vector4D column3)
 {
     _m11 = column1.X; _m12 = column2.X; _m13 = column3.X;
     _m21 = column1.Y; _m22 = column2.Y; _m23 = column3.Y;
     _m31 = column1.Z; _m32 = column2.Z; _m33 = column3.Z;
 }
コード例 #57
0
 /**
  * Copy constructor.
  */
 public BuildGeomFilter(BuildGeomFilter rhs)
     : base(rhs)
 {
     overall_color = rhs.overall_color;
     raster_overlay_max_size = rhs.raster_overlay_max_size;
     raster_overlay_script = rhs.raster_overlay_script;
     color_script = rhs.color_script;
     feature_name_script = rhs.feature_name_script;
 }
コード例 #58
0
 /// <summary>
 /// Adds two vectors.
 /// </summary>
 /// <param name="left">A <see cref="Vector4D"/> instance.</param>
 /// <param name="right">A <see cref="Vector4D"/> instance.</param>
 /// <returns>A new <see cref="Vector4D"/> instance containing the sum.</returns>
 public static Vector4D Add(Vector4D left, Vector4D right)
 {
     return(new Vector4D(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W));
 }
コード例 #59
0
ファイル: Transform3D.cs プロジェクト: ddanninger/PLMPack
        /// <summary>
        /// Transform vector using rotation part only of matrix
        /// </summary>
        /// <param name="vec">input vector</param>
        /// <returns></returns>
        public Vector3D transformRot(Vector3D vec)
        {
            Vector4D vecTransf = MatrixRot * (new Vector4D(vec.X, vec.Y, vec.Z, 1.0));

            return(new Vector3D(vecTransf.X, vecTransf.Y, vecTransf.Z));
        }
コード例 #60
0
ファイル: Vector4D.cs プロジェクト: minrogi/PLMPack
		/// <summary>
		/// Adds two vectors.
		/// </summary>
		/// <param name="left">A <see cref="Vector4D"/> instance.</param>
		/// <param name="right">A <see cref="Vector4D"/> instance.</param>
		/// <returns>A new <see cref="Vector4D"/> instance containing the sum.</returns>
		public static Vector4D Add(Vector4D left, Vector4D right)
		{
			return new Vector4D(left.X + right.X, left.Y + right.Y, left.Z + right.Z, left.W + right.W);
		}