MapXtreme 2005 learning experience road area selection (13)

In fact, the choice of the road when there is some problem.

One problem: the road show before when taking two points each drew a line on the display, so that when selecting road, just select the line between two points. In fact, one way might be more than one point, and so the choice of the road, the entire road should be checked.

After tossing, the code to draw the line into the following, combined into a multi-point line.

 

05233622_d6i3.gif Code
 FeatureGeometry pt  =   new  MultiCurve(Layer.CoordSys, CurveSegmentType.Linear,点数组);
            SimpleLineStyle lineStyle 
=   new  SimpleLineStyle( new  LineWidth( 4 , LineWidthUnit.Pixel), 线样式,颜色);
            CompositeStyle comStyle 
=   new  CompositeStyle(lineStyle);
            Feature feature 
=   new  MapInfo.Data.Feature(Table.TableInfo.Columns);
            feature.Geometry 
=  pt;
            feature.Style 
=  comStyle;
            Table.InsertFeature(feature);

 

 

After the set points by drawing a line, and then select the line tool PointSelect time, you can select the entire line.

 

Second problem: After selecting a road or area data exchange needs to display, as shown below:

 So, the choice point of time, we need to get the selected data points, where the beginning of detours, Ajax again by clicking on the query graph near the point of metadata to find the data, the results of the investigation of discrepancies with the data point selection.

After the toss, we found from

 

 MapInfo.Engine.Session.Current.Selections.DefaultSelection[MapInfo.Engine.Session.Current.Catalog.GetTable(表别名)];

 

 

You can choose to get data directly.

 

Question three: how to change the style of the selected roads or areas

Scoured the Chinese search engine, almost no answer, finally found in English, finally found the results:

After tossing, as follows:

05233622_d6i3.gif Code
SimpleLineStyle lineStyle  =   new  SimpleLineStyle( new  LineWidth( 4 , LineWidthUnit.Pixel), 2 ,System.Drawing.Color.Red, true );
                AreaStyle areaStyle 
=   new  MapInfo.Styles.AreaStyle(lineStyle,  new  MapInfo.Styles.SimpleInterior( 9 ,System.Drawing.Color.Blue, System.Drawing.Color.Blue,  true ));
                
                Session.Current.Selections.DefaultSelection.Style.AreaStyle.ApplyStyle(areaStyle);
                Session.Current.Selections.DefaultSelection.Style.LineStyle.ApplyStyle(lineStyle);

 

There are problems that, for changing the style lines, the effect is not remarkable, if the line width becomes larger, the change can be seen is the color of the border line. If you do not change, can not see a change.

 

After work for dinner, kick call it a day!

Reproduced in: https: //my.oschina.net/secyaher/blog/274273

Guess you like

Origin blog.csdn.net/weixin_33787529/article/details/91966739