当前位置: 首页>>代码示例>>C#>>正文


C# Feature.getShapes方法代码示例

本文整理汇总了C#中Feature.getShapes方法的典型用法代码示例。如果您正苦于以下问题:C# Feature.getShapes方法的具体用法?C# Feature.getShapes怎么用?C# Feature.getShapes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Feature的用法示例。


在下文中一共展示了Feature.getShapes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: process

        public override FeatureList process(Feature input, FilterEnv env)
        {


            FeatureList output = new FeatureList();
            if (transform != null && !transform.Identity())
            {
                foreach (GeoShape shape in input.getShapes())
                {
                    XformVisitor visitor = new XformVisitor();
                    visitor.trans = transform;
                    shape.accept(visitor);
                }
            }

            output.Add(input);
            return output;
#if TODO
            // resolve the xlate shortcut
            Matrix working_matrix = xform_matrix;

            // TODO: this can go into process(FeatureList) instead of running for every feature..
            if (getTranslateScript() != null)
            {
                ScriptResult r = env.getScriptEngine().run(getTranslateScript(), input, env);
                if (r.isValid())
                    working_matrix = Matrix.translate(r.asVec3());
                else
                    env.getReport().error(r.asString());
            }

            if (working_srs != null || (working_matrix != null && !working_matrix.IsIdentity))
            {
                foreach (GeoShape shape in input.getShapes())
                {
                    if (working_matrix != null && !working_matrix.IsIdentity)
                    {

                        XformVisitor visitor;
                        visitor.mat = working_matrix;
                        shape.accept(visitor);
                    }

                    if (working_srs != null && !working_srs.equivalentTo(env.getInputSRS()))
                    {
                        working_srs.transformInPlace(shape);
                    }
                }
            }

            output.Add(input);
            return output;
#endif
            throw new NotImplementedException();
        }
开发者ID:agustinsantos,项目名称:mogregis3d,代码行数:55,代码来源:MathTransformFilter.cs

示例2: process

        public override FragmentList process(Feature input, FilterEnv env)
        {
            FragmentList output;

            // LIMITATION: this filter assumes all feature's shapes are the same
            // shape type! TODO: sort into bins of shape type and create a separate
            // geometry for each. Then merge the geometries.
            bool needs_tessellation = false;

            Fragment frag = new Fragment();

            GeoShapeList shapes = input.getShapes();
            #if TODO
            // if we're in batch mode, the color was resolved in the other process() function.
            // otherwise we still need to resolve it.
            Vector4D color = getColorForFeature(input, env);
            #endif
            #if TODO
            foreach (GeoShape s in shapes)
            {
                GeoShape shape = s;

                if (shape.getShapeType() == GeoShape.ShapeType.TYPE_POLYGON)
                {
                    needs_tessellation = true;
                }

                osg.Geometry geom = new osg.Geometry();

                // TODO: pre-total points and pre-allocate these arrays:
                osg.Vec3Array verts = new osg.Vec3Array();
                geom.setVertexArray(verts);
                uint vert_ptr = 0;

                // per-vertex coloring takes more memory than per-primitive-set coloring,
                // but it renders faster.
                osg.Vec4Array colors = new osg.Vec4Array();
                geom.setColorArray(colors);
                geom.setColorBinding(osg.Geometry.BIND_PER_VERTEX);

                //osg.Vec3Array* normals = new osg.Vec3Array();
                //geom.setNormalArray( normals );
                //geom.setNormalBinding( osg.Geometry.BIND_OVERALL );
                //normals.push_back( osg.Vec3( 0, 0, 1 ) );

                Mogre.PixelFormat prim_type =
                    shape.getShapeType() == GeoShape.ShapeType.TYPE_POINT ? osg.PrimitiveSet.POINTS :
                    shape.getShapeType() == GeoShape.ShapeType.TYPE_LINE ? osg.PrimitiveSet.LINE_STRIP :
                    osg.PrimitiveSet.LINE_LOOP;
            #endif
            #if TODO
                for (int pi = 0; pi < shape.getPartCount(); pi++)
                {
                    int part_ptr = vert_ptr;
                    GeoPointList points = shape.getPart(pi);
                    for (int vi = 0; vi < points.Count; vi++)
                    {
                        verts.Add(points[vi]);
                        vert_ptr++;
                        colors.Add(color);
                    }
                    geom.addPrimitiveSet(new osg.DrawArrays(prim_type, part_ptr, vert_ptr - part_ptr));
                }

                // tessellate all polygon geometries. Tessellating each geometry separately
                // with TESS_TYPE_GEOMETRY is much faster than doing the whole bunch together
                // using TESS_TYPE_DRAWABLE.
                if (needs_tessellation)
                {
                    osgUtil.Tessellator tess;
                    tess.setTessellationType(osgUtil.Tessellator.TESS_TYPE_GEOMETRY);
                    tess.setWindingType(osgUtil.Tessellator.TESS_WINDING_POSITIVE);
                    tess.retessellatePolygons(*geom);

                    applyOverlayTexturing(geom, input, env);
                }

                generateNormals(geom);

                frag.addDrawable(geom);
            }

            frag.addAttributes(input.getAttributes());
            applyFragmentName(frag, input, env);

            output.Add(frag);

            return output;
            #endif
            throw new NotImplementedException();
        }
开发者ID:agustinsantos,项目名称:mogregis3d,代码行数:91,代码来源:BuildGeomFilter.cs

示例3: process

        protected virtual FragmentList process(Feature input, FilterEnv env)
        {
            FragmentList output;

            // the text string:
            string text;
            if (getTextScript() != null)
            {
                ScriptResult r = env.getScriptEngine().run(getTextScript(), input, env);
                if (r.isValid())
                    text = r.asString();
                else
                    env.getReport().error(r.asString());
            }

            // resolve the size:
            double font_size = 16.0;
            if (getFontSizeScript() != null)
            {
                ScriptResult r = env.getScriptEngine().run(getFontSizeScript(), input, env);
                if (r.isValid())
                    font_size = r.asDouble(font_size);
                else
                    env.getReport().error(r.asString());
            }

            // the text color:
            Vector4D color = getColorForFeature(input, env);

            // calculate the 3D centroid of the feature:
            // TODO: move this to the geoshapelist class
            Vector3D point = new Vector3D(input.getExtent().getCentroid());
            ZCalc zc;
            input.getShapes().accept(zc);
            point.z() = zc.z_count > 0 ? zc.z_sum / (double)zc.z_count : 0.0;

            // build the drawable:
            osgText.Text t = new osgText.Text();
            t.setAutoRotateToScreen(true);
            t.setCharacterSizeMode(osgText.Text.SCREEN_COORDS);
            t.setAlignment(osgText.Text.CENTER_CENTER);
            t.setText(text.c_str());
            t.setColor(color);
            t.setCharacterSize((float)font_size);
            t.setPosition(point);
            t.setBackdropType(osgText.Text.OUTLINE);
            t.setBackdropColor(osg.Vec4(0, 0, 0, 1));

            #if PENDING
            // testing the flat-label approach here:
            osg.Matrix cell2map = env.getInputSRS().getInverseReferenceFrame();
            osg.Vec3d feature_center = point * cell2map;
            feature_center.normalize();
            osg.Vec3d cell_center = osg.Vec3d(0,0,1) * cell2map;
            cell_center.normalize();
            osg.Quat q;
            q.makeRotate( cell_center, feature_center );
            t.setRotation( q );
            t.setAutoRotateToScreen( false );
            // end of flat label approach
            #endif

            if (font.valid())
            {
                t.setFont(font.get());
            }

            if (getDisableDepthTest())
            {
                t.getOrCreateStateSet().setAttribute(new osg.Depth(osg.Depth.ALWAYS, 0, 1, false), osg.StateAttribute.ON);
            }

            output.Add(new Fragment(t));

            return output;
        }
开发者ID:agustinsantos,项目名称:mogregis3d,代码行数:76,代码来源:BuildLabelsFilter.cs


注:本文中的Feature.getShapes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。