示例#1
0
 private void SetupPopulationDensity()
 {
     TooltipHeaderFieldNamePair[] tooltipPairs;
     tooltipPairs = new TooltipHeaderFieldNamePair[] { 
         new TooltipHeaderFieldNamePair("State: ", "STATE_NAME"),
         new TooltipHeaderFieldNamePair("Pop per Sqr Mile: ", "POP90_SQMI")};
     SetupCustomRenderSettings("POP90_SQMI", 0, tooltipPairs);
     tooltipPairs = new TooltipHeaderFieldNamePair[] { 
         new TooltipHeaderFieldNamePair("County: ", "NAME"),
         new TooltipHeaderFieldNamePair("Pop per Sqr Mile: ", "POP90_SQMI")};
     SetupCustomRenderSettings("POP90_SQMI", 1, tooltipPairs);
 }
示例#2
0
        private void SetupMedianRent()
        {
            TooltipHeaderFieldNamePair[] tooltipPairs;
            tooltipPairs = new TooltipHeaderFieldNamePair[] { 
                new TooltipHeaderFieldNamePair("State: ", "STATE_NAME"),
                new TooltipHeaderFieldNamePair("Median Rent: $", "MEDIANRENT")};
            SetupCustomRenderSettings("MEDIANRENT", 0, tooltipPairs);

            tooltipPairs = new TooltipHeaderFieldNamePair[] { 
                new TooltipHeaderFieldNamePair("County: ", "NAME"),
                new TooltipHeaderFieldNamePair("Median Rent: $", "MEDIANRENT")};

            SetupCustomRenderSettings("MEDIANRENT", 1, tooltipPairs);
        }        
        private void SetupCustomRenderSettings(string fieldName, int layerIndex, TooltipHeaderFieldNamePair[] tooltipFields)
        {
            //get the required layer
            EGIS.ShapeFileLib.RenderSettings renderSettings = SFMap1.GetLayer(layerIndex).RenderSettings;
            int numRecords = SFMap1.GetLayer(layerIndex).RecordCount;
            EGIS.ShapeFileLib.DbfReader dbfReader = renderSettings.DbfReader;
            int fieldIndex = dbfReader.IndexOfFieldName(fieldName);

            double[] samples = new double[numRecords];
            //find the range of population values and obtain the quintile quantiles
            for (int n = 0; n < numRecords; n++)
            {


                if (String.IsNullOrEmpty(dbfReader.GetField(n, fieldIndex)) == false)
                {
                    string tmp = dbfReader.GetField(n, fieldIndex);
                    int value;
                    if (int.TryParse(tmp, out value))
                    {
                        double d = double.Parse(dbfReader.GetField(n, fieldIndex), System.Globalization.CultureInfo.InvariantCulture);
                        samples[n] = d;
                    }
                }
            }
            double[] ranges = GetQuintiles(samples);

            //create the quintile colors - there will be 1 more color than the number of elements in quantiles
            Color[] cols = new Color[] { 
                Color.FromArgb(96,169, 5), 
                Color.FromArgb(201, 200, 123), 
                Color.FromArgb(157, 135, 151), 
                Color.FromArgb(112, 155, 235),
                Color.FromArgb(255,0,0)};

            //setup the list of tooltip fields
            System.Collections.Generic.List<TooltipHeaderFieldNamePair> tooltipPairList = null;
            if (tooltipFields != null)
            {
                tooltipPairList = new System.Collections.Generic.List<TooltipHeaderFieldNamePair>();
                tooltipPairList.AddRange(tooltipFields);
            }

            //create a new QuantileCustomRenderSettings and add it to the SFMap
            QuantileCustomRenderSettings rcrs = new QuantileCustomRenderSettings(renderSettings, cols, ranges, fieldName, tooltipPairList);
            SFMap1.SetCustomRenderSettings(layerIndex, rcrs);

        }
        private void SetupPopulation()
        {
            TooltipHeaderFieldNamePair[] tooltipPairs;
            tooltipPairs = new TooltipHeaderFieldNamePair[] { 
                new TooltipHeaderFieldNamePair("District: ", "NAME_3"),
                new TooltipHeaderFieldNamePair("Population: ", "popu_mis")};
            SetupCustomRenderSettings("popu_mis", 0, tooltipPairs);

            /*
            tooltipPairs = new TooltipHeaderFieldNamePair[] { 
                    new TooltipHeaderFieldNamePair("County: ", "popu_mis"),
                    new TooltipHeaderFieldNamePair("Median Rent: $", "popu_mis")};

            SetupCustomRenderSettings("popu_mis", 1, tooltipPairs);
             */
        }
示例#5
0
 private void SetupDivorced()
 {
     TooltipHeaderFieldNamePair[] tooltipPairs;
     tooltipPairs = new TooltipHeaderFieldNamePair[] { 
         new TooltipHeaderFieldNamePair("State: ", "STATE_NAME"),
         new TooltipHeaderFieldNamePair("Number Divorced: ", "DIVORCED"),
         new TooltipHeaderFieldNamePair("Number Married: ", "MARRIED")};
     SetupCustomRenderSettings("DIVORCED", 0, tooltipPairs);
     tooltipPairs = new TooltipHeaderFieldNamePair[] { 
         new TooltipHeaderFieldNamePair("County: ", "NAME"),
         new TooltipHeaderFieldNamePair("Number Divorced: ", "DIVORCED"),
         new TooltipHeaderFieldNamePair("Number Married: ", "MARRIED")};
     SetupCustomRenderSettings("DIVORCED", 1, tooltipPairs);
 }
示例#6
0
 private void SetupAverageSalePrice()
 {
     TooltipHeaderFieldNamePair[] tooltipPairs;
     tooltipPairs = new TooltipHeaderFieldNamePair[] { 
         new TooltipHeaderFieldNamePair("State: ", "STATE_NAME"),
         new TooltipHeaderFieldNamePair("1987 Average House Sale: $", "AVG_SALE87")};
     SetupCustomRenderSettings("AVG_SALE87", 0, tooltipPairs);
     tooltipPairs = new TooltipHeaderFieldNamePair[] { 
         new TooltipHeaderFieldNamePair("County: ", "NAME"),
         new TooltipHeaderFieldNamePair("1987 Average House Sale: $", "AVG_SALE87")};
     SetupCustomRenderSettings("AVG_SALE87", 1, tooltipPairs);
 }