Esempio n. 1
0
        // Creates a theme that shows symbols for negative values.
        // Also uses the NumericNull property to hide the symbol of
        // the greatest theme value.
        private void NegativeValueTheme(Map map)
        {
            // Get table from the feature layer
            MapInfo.Mapping.FeatureLayer mexicoLayer = map.Layers["mexico"] as MapInfo.Mapping.FeatureLayer;
            MapInfo.Data.Table           mexicoTable = mexicoLayer.Table;
            // Add a temporary column to the mexico table,
            // calulating the difference between Pop_90 and Pop_80
            MapInfo.Data.Columns tempColumns = new MapInfo.Data.Columns();
            tempColumns.Add(new MapInfo.Data.Column("CarsMinusTrucks", "(Cars_91-Trucks_91)"));
            mexicoTable.AddColumns(tempColumns);
            // Create the theme
            GraduatedSymbolTheme theme = new GraduatedSymbolTheme(mexicoTable, "CarsMinusTrucks");

            // Show Negative symbols
            theme.ShowNegativeSymbol = true;
            // Setup symbols
            theme.PositiveSymbol = new MapInfo.Styles.SimpleVectorPointStyle(35, Color.Blue, 18);
            theme.NegativeSymbol = new MapInfo.Styles.SimpleVectorPointStyle(35, Color.Red, 36);
            // Get the larget value in the theme column
            MapInfo.Data.MIDataReader reader = mexicoTable.ExecuteReader("MAX(CarsMinusTrucks)");
            reader.MoveNext();
            double maxValue = reader.GetDouble(0);

            reader.Dispose();
            // Setup the numeric null value to exclude the largest value
            theme.NumericNull    = maxValue;
            theme.HasNumericNull = true;
            // These end up being small values, so use the DataValueAtSize
            // property to increase the size of the symbols
            theme.DataValueAtSize = 50000;
            // Create the theme layer
            ObjectThemeLayer themeLayer = new ObjectThemeLayer("CarOrTruck", "CarOrTruck", theme);

            // Add theme layer to the map
            map.Layers.Add(themeLayer);
        }
Esempio n. 2
0
 // Creates a theme that shows symbols for negative values.
 // Also uses the NumericNull property to hide the symbol of
 // the greatest theme value.
 private void NegativeValueTheme(Map map)
 {
     // Get table from the feature layer
     MapInfo.Mapping.FeatureLayer mexicoLayer = map.Layers["mexico"] as MapInfo.Mapping.FeatureLayer;
     MapInfo.Data.Table mexicoTable = mexicoLayer.Table;
     // Add a temporary column to the mexico table,
     // calulating the difference between Pop_90 and Pop_80
     MapInfo.Data.Columns tempColumns = new MapInfo.Data.Columns();
     tempColumns.Add(new MapInfo.Data.Column("CarsMinusTrucks", "(Cars_91-Trucks_91)"));
     mexicoTable.AddColumns(tempColumns);
     // Create the theme
     GraduatedSymbolTheme theme = new GraduatedSymbolTheme(mexicoTable, "CarsMinusTrucks");
     // Show Negative symbols
     theme.ShowNegativeSymbol = true;
     // Setup symbols
     theme.PositiveSymbol = new MapInfo.Styles.SimpleVectorPointStyle(35, Color.Blue, 18);
     theme.NegativeSymbol = new MapInfo.Styles.SimpleVectorPointStyle(35, Color.Red, 36);
     // Get the larget value in the theme column
     MapInfo.Data.MIDataReader reader = mexicoTable.ExecuteReader("MAX(CarsMinusTrucks)");
     reader.MoveNext();
     double maxValue = reader.GetDouble(0);
     reader.Dispose();
     // Setup the numeric null value to exclude the largest value
     theme.NumericNull = maxValue;
     theme.HasNumericNull = true;
     // These end up being small values, so use the DataValueAtSize
     // property to increase the size of the symbols
     theme.DataValueAtSize = 50000;
     // Create the theme layer
     ObjectThemeLayer themeLayer = new ObjectThemeLayer("CarOrTruck", "CarOrTruck", theme);
     // Add theme layer to the map
     map.Layers.Add(themeLayer);
 }