public ColorMapActor(double layerAltitude, BindingsSource bs, ObservableCollection<VisualizationDataSource> dataSources, Host host)
            : base(bs)
        {
            LinearPalette palette = new LinearPalette(swm.Colors.Blue, swm.Colors.Green, swm.Colors.Red);
            palette.IncreaseBrightness = false;
            this.palette = palette;

            meshLayers = new List<MeshLayer>();
            layerHelper = new LayerHelper(layerAltitude);

            this.host = host;

            dataSources.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(dataSources_CollectionChanged);
        }
        public ColorMapHelper(WarpedDataSource2D<double> field, Box2 regionBox, double minT, double maxT)
        {
            this.minT = minT;
            this.maxT = maxT;

            warpedField = field;

            if (regionBox != null)
            {
                this.tileBox = new GeoRect(
                    regionBox.MinCoordinate.X, regionBox.MinCoordinate.Y,
                    regionBox.MaxCoordinate.X - regionBox.MinCoordinate.X,
                    regionBox.MaxCoordinate.Y - regionBox.MinCoordinate.Y);
                this.regionBox = regionBox;
            }

            System.Windows.Point[,] grid = warpedField.Grid;

            Coordinate2D minCoordinate = new Coordinate2D(grid[0, 0].X, grid[0, 0].Y);
            Coordinate2D maxCoordinate = new Coordinate2D(grid[warpedField.Width - 1, warpedField.Height - 1].X, grid[warpedField.Width - 1, warpedField.Height - 1].Y);


            for (int j = 0; j < warpedField.Height; j++)
            {
                for (int i = 0; i < warpedField.Width; i++)
                {
                    if (grid[i, j].X < minCoordinate.X)
                        minCoordinate.X = grid[i, j].X;

                    if (grid[i, j].X > maxCoordinate.X)
                        maxCoordinate.X = grid[i, j].X;

                    if (grid[i, j].Y < minCoordinate.Y)
                        minCoordinate.Y = grid[i, j].Y;

                    if (grid[i, j].Y > maxCoordinate.Y)
                        maxCoordinate.Y = grid[i, j].Y;
                }
            }

            gridBox = new GeoRect(
                minCoordinate.X,
                minCoordinate.Y,
                maxCoordinate.X - minCoordinate.X,
                maxCoordinate.Y - minCoordinate.Y);

            palette = new LinearPalette(swm.Colors.Blue, swm.Colors.Green, swm.Colors.Red);
            workingTriangle = new RasterTriangle();
        }