示例#1
0
        static XmlElement encodeFilterGraph(XmlDocument doc, FilterGraph graph)
        {
#if TODO
            XmlElement graph_e = doc.CreateElement("graph");

            graph_e.SetAttribute("name", graph.getName());

            foreach (Filter f in graph.getFilters())
            {
                XmlElement filter_e = doc.CreateElement("filter");
                //XmlAttributeCollection attrs = new XmlAttributeCollection(filter_e);
                //attrs["type"] = f.getFilterType();

                XmlAttribute xmlAttrib = doc.CreateAttribute("type");
                xmlAttrib.Value = f.getFilterType();
                filter_e.Attributes.Append(xmlAttrib);

                Properties props = f.getProperties();
                foreach (Property i in props)
                {
                    filter_e.AppendChild(encodeProperty(doc, i));
                }

                graph_e.AppendChild(filter_e);
            }
            return(graph_e);
#endif
            throw new NotImplementedException();
        }
示例#2
0
        static XmlElement encodeFilterGraph(XmlDocument doc, FilterGraph graph)
        {
            #if TODO
            XmlElement graph_e = doc.CreateElement("graph");

            graph_e.SetAttribute("name", graph.getName());

            foreach (Filter f in graph.getFilters())
            {

                XmlElement filter_e = doc.CreateElement("filter");
                //XmlAttributeCollection attrs = new XmlAttributeCollection(filter_e);
                //attrs["type"] = f.getFilterType();

                XmlAttribute xmlAttrib = doc.CreateAttribute("type");
                xmlAttrib.Value = f.getFilterType();
                filter_e.Attributes.Append(xmlAttrib);

                Properties props = f.getProperties();
                foreach (Property i in props)
                {
                    filter_e.AppendChild(encodeProperty(doc, i));
                }

                graph_e.AppendChild(filter_e);
            }
            return graph_e;
            #endif
            throw new NotImplementedException();
        }
示例#3
0
        public void render2d(Project project, PictureBox picBox)
        {
            SharpMap.Map myMap = new SharpMap.Map();

            foreach (BuildLayer layer in project.getLayers())
            {
                Source source = layer.getSource();

                BoundingBox    envelope = new BoundingBox(-1000.0, -1000.0, 1000.0, 1000.0);//TODO
                FeatureDataSet ds       = new FeatureDataSet();
                source.DataSource.Open();
                source.DataSource.ExecuteIntersectionQuery(envelope, ds);
                source.DataSource.Close();

                FeatureDataTable features = (FeatureDataTable)ds.Tables[0];

                string label = "Trace test:\n";

                foreach (FeatureDataRow row in features)
                {
                    foreach (Object item in row.ItemArray)
                    {
                        label += " - " + item;
                    }
                    label += "\n";
                }

                setLabel(label);

                //Show map

                //Filters
                FilterGraph graph = project.getFilterGraph(source.getName());
                if (graph != null)
                {
                    foreach (FeatureFilter filter in graph.getFilters())
                    {
                        //aplicar filtro segun el tipo
                        Mogre.DefaultSceneManagerFactory dsmf = new DefaultSceneManagerFactory();
                        Mogre.SceneManager sm  = dsmf.CreateInstance("scenemanager");
                        FilterEnv          env = new FilterEnv(sm, "env");
                        foreach (MogreGis.Resource resource in project.getResources())
                        {
                            env.getSession().Resources.addResource(resource);
                        }
                        FeatureList list = Feature.DataTableToList(features);
                        filter.process(list, env);
                        //falta devolver la lista y procesarla ***************************************
                    }
                }

                SharpMap.Layers.VectorLayer myLayer = new SharpMap.Layers.VectorLayer(layer.getName());
                myLayer.DataSource = source.DataSource;
                myMap.Layers.Add(myLayer);
            }

            myMap.Size = new Size(picBox.Width, picBox.Height);
            myMap.ZoomToExtents();
            picBox.Image = myMap.GetMap();
            this.map     = myMap;
        }