Exemplo n.º 1
0
        //--------------------------------------------------------------------------------
        #region ** ctor

        public C1FlexDataTree()
        {
            Initialize();

            // create 'header' grid <<1.1>>
            _hdr = new GridHeader(this);
        }
Exemplo n.º 2
0
 private void ProcessObject(PSObject input)
 {
     if (this.windowProxy.IsWindowClosed())
     {
         LocalPipeline currentlyRunningPipeline = (LocalPipeline)base.Context.CurrentRunspace.GetCurrentlyRunningPipeline();
         if ((currentlyRunningPipeline != null) && !currentlyRunningPipeline.IsStopping)
         {
             currentlyRunningPipeline.StopAsync();
         }
     }
     else
     {
         object baseObject = input.BaseObject;
         if (((baseObject is ScriptBlock) || (baseObject is SwitchParameter)) || (((baseObject is PSReference) || (baseObject is FormatInfoData)) || (baseObject is PSObject)))
         {
             ErrorRecord errorRecord = new ErrorRecord(new FormatException(StringUtil.Format(FormatAndOut_out_gridview.DataNotQualifiedForGridView, new object[0])), "DataNotQualifiedForGridView", ErrorCategory.InvalidType, null);
             base.ThrowTerminatingError(errorRecord);
         }
         if (this.gridHeader == null)
         {
             this.windowProxy.ShowWindow();
             this.gridHeader = GridHeader.ConstructGridHeader(input, this);
         }
         else
         {
             this.gridHeader.ProcessInputObject(input);
         }
         Exception lastException = this.windowProxy.GetLastException();
         if (lastException != null)
         {
             ErrorRecord record2 = new ErrorRecord(lastException, "ManagementListInvocationException", ErrorCategory.OperationStopped, null);
             base.ThrowTerminatingError(record2);
         }
     }
 }
Exemplo n.º 3
0
        private Grid ReadGrid(BinaryReader reader, GridHeader header, bool accuracies = false)
        {
            int count = header.GS_COUNT;

            byte[] buffer = new byte[16];

            var grid = new Grid(header, accuracies);

            ShiftRecord record;

            for (int i = 0; i < count; i++)
            {
                reader.Read(buffer, 0, 16);

                record.Item1 = BitConverter.ToSingle(buffer, 0);
                record.Item2 = BitConverter.ToSingle(buffer, 4);

                grid.shifts[i] = record;

                if (accuracies)
                {
                    record.Item1 = BitConverter.ToSingle(buffer, 8);
                    record.Item2 = BitConverter.ToSingle(buffer, 12);

                    grid.accuracies[i] = record;
                }
            }

            return(grid);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Execute formatting on a single object.
        /// </summary>
        /// <param name="input">object to process</param>
        private void ProcessObject(PSObject input)
        {
            // Make sure the OGV window is not closed.
            if (_windowProxy.IsWindowClosed())
            {
                LocalPipeline pipeline = (LocalPipeline)this.Context.CurrentRunspace.GetCurrentlyRunningPipeline();

                if (pipeline != null && !pipeline.IsStopping)
                {
                    // Stop the pipeline cleanly.
                    pipeline.StopAsync();
                }

                return;
            }

            object baseObject = input.BaseObject;

            // Throw a terminating error for types that are not supported.
            if (baseObject is ScriptBlock ||
                baseObject is SwitchParameter ||
                baseObject is PSReference ||
                baseObject is FormatInfoData ||
                baseObject is PSObject)
            {
                ErrorRecord error = new ErrorRecord(
                    new FormatException(StringUtil.Format(FormatAndOut_out_gridview.DataNotQualifiedForGridView)),
                    DataNotQualifiedForGridView,
                    ErrorCategory.InvalidType,
                    null);

                this.ThrowTerminatingError(error);
            }

            if (_gridHeader == null)
            {
                // Columns have not been added yet; Start the main window and add columns.
                _windowProxy.ShowWindow();
                _gridHeader = GridHeader.ConstructGridHeader(input, this);
            }
            else
            {
                _gridHeader.ProcessInputObject(input);
            }

            // Some thread synchronization needed.
            Exception exception = _windowProxy.GetLastException();

            if (exception != null)
            {
                ErrorRecord error = new ErrorRecord(
                    exception,
                    "ManagementListInvocationException",
                    ErrorCategory.OperationStopped,
                    null);

                this.ThrowTerminatingError(error);
            }
        }
Exemplo n.º 5
0
 internal GridSourceHeader(GridHeader header)
 {
     _header = header;
     if (header == null)
     {
         throw new NullReferenceException("Internal reference is null");
     }
 }
Exemplo n.º 6
0
        //--------------------------------------------------------------------------------
        #region ** ctor

        public C1FlexDataTree()
        {
            Initialize();

            // create 'header' grid <<1.1>>
            _hdr = new GridHeader(this);

            // when user filters the data using the header grid, collapse all children
            _hdr.BeforeFilter += (s, e) =>
            {
                CollapseAll();
            };
        }
Exemplo n.º 7
0
        public void CreateNewTest()
        {
            SuperGrid    target       = new SuperGrid();    // TODO: Initialize to an appropriate value
            string       Filename     = string.Empty;       // TODO: Initialize to an appropriate value
            GridHeader   Header       = null;               // TODO: Initialize to an appropriate value
            GridDataType DataType     = new GridDataType(); // TODO: Initialize to an appropriate value
            object       InitialValue = null;               // TODO: Initialize to an appropriate value
            bool         InRam        = false;              // TODO: Initialize to an appropriate value
            GridFileType FileType     = new GridFileType(); // TODO: Initialize to an appropriate value
            ICallback    cBack        = null;               // TODO: Initialize to an appropriate value
            bool         expected     = false;              // TODO: Initialize to an appropriate value
            bool         actual;

            actual = target.CreateNew(Filename, Header, DataType, InitialValue, InRam, FileType, cBack);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Exemplo n.º 8
0
        private void CheckNewMethods()
        {
            axMap1.DeserializeLayer(1, "Test");
            var projection = new GeoProjection();

            projection.ImportFromProj4("g");
            var t = tkSavingMode.modeXMLOverwrite;

            axMap1.SaveMapState("r", true, true);

            axMap1.set_LayerSkipOnSaving(1, true);

            var sf = new Shapefile();
            var reprojectedCount = 0;

            sf.Reproject(projection, ref reprojectedCount);
            var geoProjection = sf.GeoProjection;
            var sfSimple      = sf.SimplifyLines(10, false);

            var gridHeader = new GridHeader();
            var gridHeaderGeoProjection = gridHeader.GeoProjection;

            var ext = axMap1.MaxExtents;

            var utils = new Utils();

            utils.ClipGridWithPolygon("test", sfSimple.Shape[0], "new", false);

            utils.Polygonize(string.Empty, string.Empty, 1, false, string.Empty, "ESRI Shapefile", string.Empty);

            utils.GDALInfo(string.Empty, string.Empty);
            utils.TranslateRaster(string.Empty, string.Empty, string.Empty);

            utils.OGRInfo(string.Empty, string.Empty);
            utils.OGR2OGR(string.Empty, string.Empty, string.Empty);
            utils.GDALAddOverviews(string.Empty, string.Empty, string.Empty);
            utils.GDALBuildVrt(string.Empty, string.Empty);
            utils.GDALRasterize(string.Empty, string.Empty, string.Empty);
            utils.GDALWarp(string.Empty, string.Empty, string.Empty);

            var ds = new GdalDataset();
            var subDatasetCount = ds.SubDatasetCount;
        }
Exemplo n.º 9
0
        private Grid ReadGrid(StreamReader reader, GridHeader header, bool accuracies = false)
        {
            int i     = 0;
            int count = header.GS_COUNT;

            var grid = new Grid(header, accuracies);

            string line;

            char[] separator = new char[] { ' ' };

            ShiftRecord record;

            var format = CultureInfo.InvariantCulture.NumberFormat;

            while (i < count && (line = reader.ReadLine()) != null)
            {
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }

                var s = line.Split(separator, StringSplitOptions.RemoveEmptyEntries);

                record.Item1 = float.Parse(s[0], format);
                record.Item2 = float.Parse(s[1], format);

                grid.shifts[i] = record;

                if (accuracies && s.Length > 2)
                {
                    record.Item1 = float.Parse(s[2], format);
                    record.Item2 = float.Parse(s[3], format);

                    grid.accuracies[i] = record;
                }

                i++;
            }

            return(grid);
        }
        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var element = this.Automator.ElementsRegistry.GetRegisteredElement(registeredKey);

            GridHeader gridHeader = element.FlaUIElement.AsGridHeader();

            var result = gridHeader.Columns;

            var flaUiDriverElementList = result
                                         .Select <AutomationElement, FlaUIDriverElement>((Func <AutomationElement, FlaUIDriverElement>)(x => new FlaUIDriverElement(x)))
                                         .ToList <FlaUIDriverElement>();

            var registeredKeys = this.Automator.ElementsRegistry.RegisterElements(flaUiDriverElementList);

            var registeredObjects = registeredKeys.Select(e => new JsonElementContent(e));

            return(this.JsonResponse(ResponseStatus.Success, registeredObjects));
        }
Exemplo n.º 11
0
        protected virtual void InitializeGridRows(ViewListSettings settings)
        {
            ClearGridControls();

            if (settings.ShowColumnCaptions)
            {
                GridHeader = new ListHeader()
                {
                    Height = settings.RowHeight.HasValue ? settings.RowHeight.Value : DefaultRowHeight
                };
            }

            var gridRow = new ListRow()
            {
                Height = settings.RowHeight.HasValue ? settings.RowHeight.Value : DefaultRowHeight,
                Index  = 0
            };

            ColumnBuilderService.BuildGridColumns(settings, GridHeader.Controls, gridRow.Controls);

            pnlDetail.Controls.Add(GridHeader);

            if (State.ListSettings.Columns.Count > 0)
            {
                gridRow.Controls.OfType <Label>().FirstOrDefault(c => ((ViewListColumn)c.Tag).Index == 0).Text = "0";

                pnlDetail.Controls.Add(gridRow);

                var maxRows = settings.MaxRows.HasValue ? settings.MaxRows.Value : 8;

                for (int i = 1; i < maxRows; i++)
                {
                    var newRow = gridRow.DeepCopy();
                    newRow.Index = i;
                    newRow.Controls.OfType <Label>().FirstOrDefault(c => ((ViewListColumn)c.Tag).Index == 0).Text = i.ToString();
                    pnlDetail.Controls.Add(newRow);
                    newRow.BringToFront();
                }
            }
            GridHeader.SendToBack();
        }
Exemplo n.º 12
0
        public void SetHeader(UIElement header)
        {
            GridHeader.FadeOut(Extensions.ContentFadeDuration);

            new Thread(() =>
            {
                Thread.Sleep(Extensions.ContentFadeDuration);

                GridHeader.Dispatcher.Invoke(() =>
                {
                    GridHeader.Children.Clear();

                    if (header != null)
                    {
                        GridHeader.Children.Add(header);
                    }

                    GridHeader.FadeIn(Extensions.ContentFadeDuration);

                    GC.Collect();
                    GC.WaitForPendingFinalizers();
                });
            }).Start();
        }
Exemplo n.º 13
0
 /// <summary>
 /// Copies the contents of another instance of the grid header.
 /// </summary>
 /// <param name="pVal">The grid header to copy setting from.</param>
 public void CopyFrom(GridHeader pVal)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 14
0
        private GridHeader ReadGridHeader(BinaryReader reader)
        {
            var header = new GridHeader();

            byte[] buffer = new byte[NAME_LEN];

            // --- SUB_NAME

            reader.Read(buffer, 0, NAME_LEN); // string
            header.SUB_NAME = reader.ReadString(buffer, NAME_LEN);

            // --- PARENT

            reader.Read(buffer, 0, NAME_LEN); // string
            header.PARENT = reader.ReadString(buffer, NAME_LEN);

            // --- CREATED

            reader.Read(buffer, 0, NAME_LEN); // string
            header.CREATED = reader.ReadString(buffer, NAME_LEN);

            // --- UPDATED

            reader.Read(buffer, 0, NAME_LEN); // string
            header.UPDATED = reader.ReadString(buffer, NAME_LEN);

            // --- S_LAT

            reader.Read(buffer, 0, NAME_LEN); // string
            header.S_LAT = reader.ReadDouble(buffer, reverse);

            // --- N_LAT

            reader.Read(buffer, 0, NAME_LEN); // string
            header.N_LAT = reader.ReadDouble(buffer, reverse);

            // --- E_LONG

            reader.Read(buffer, 0, NAME_LEN); // string
            header.E_LONG = reader.ReadDouble(buffer, reverse);

            // --- W_LONG

            reader.Read(buffer, 0, NAME_LEN); // string
            header.W_LONG = reader.ReadDouble(buffer, reverse);

            // --- LAT_INC

            reader.Read(buffer, 0, NAME_LEN); // string
            header.LAT_INC = reader.ReadDouble(buffer, reverse);

            // --- LONG_INC

            reader.Read(buffer, 0, NAME_LEN); // string
            header.LONG_INC = reader.ReadDouble(buffer, reverse);

            // --- GS_COUNT

            reader.Read(buffer, 0, NAME_LEN); // string
            header.GS_COUNT = reader.ReadInt32(buffer, reverse);

            if (padding)
            {
                reader.Read(buffer, 0, 4);
            }

            return(header);
        }
Exemplo n.º 15
0
 /// <summary>
 ///  Calculates statistics for portion of grid that is overlapped by specified polygon.
 /// </summary>
 /// <param name="Grid">Input grid</param>
 /// <param name="Header">Grid header. Can be retrieved with Grid.Header property.</param>
 /// <param name="gridExtents">Grid extents. Can be retrieved with Grid.Extents property.</param>
 /// <param name="Shape">Polygon shape within borders of which the statistics will be calculated.</param>
 /// <param name="NodataValue">No data value for grid. Can be retrieved from header.</param>
 /// <param name="MeanValue">Calculated mean value.</param>
 /// <param name="MinValue">Calculated min value.</param>
 /// <param name="MaxValue">Calculated max value</param>
 /// <returns>True on success.</returns>
 /// <remarks>Header, gridExtents, NodataValue parameters are added, so that these properties can be retrieved
 /// only ones in case the function is called multiple times for each polygon in shapefile.</remarks>
 /// \new490 Added in version 4.9.0
 public bool GridStatisticsForPolygon(Grid Grid, GridHeader Header, Extents gridExtents, Shape Shape, double NodataValue, ref double MeanValue, ref double MinValue, ref double MaxValue)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 16
0
 /// <summary>
 /// This function is not implemented. Converts a shapefile to a grid.
 /// </summary>
 /// <param name="Shpfile">The shapefile to be converted into a grid.  </param>
 /// <param name="UseShapefileBounds">Optional. A boolean value representing whether or not the grid will have the same extents
 /// as the shapefile. The default is True</param>
 /// <param name="GrdHeader">Optional. The grid header to use to create the new grid.
 /// If UseShapefileBounds is set to true, the extents supplied in the grid header will be ignored
 /// when the grid is created.</param>
 /// <param name="Cellsize">Optional. The cell size of the new grid. The default cell size is 30. </param>
 /// <param name="UseShapeNumber">Optional. Specifies that the value of each cell in the grid should be the shape index. The default value is true.</param>
 /// <param name="SingleValue">Optional. The value to use when creating the grid. This only applies when
 /// UseShapeNumber is set to false. The default value is 1.</param>
 /// <returns>The grid created from the shapefile. </returns>
 public Grid ShapefileToGrid(Shapefile Shpfile, bool UseShapefileBounds, GridHeader GrdHeader, double Cellsize, bool UseShapeNumber, short SingleValue)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 17
0
 /// <summary>
 /// Creates a new grid.
 /// </summary>
 /// <param name="Filename">The filename for the new grid. </param>
 /// <param name="Header">The header defining the attributes of the new grid.</param>
 /// <param name="DataType">The data type of the new grid.</param>
 /// <param name="InitialValue">The initial value for each cell of the new grid.</param>
 /// <param name="InRam">Optional. A boolean value representing the grid being stored in memory(RAM) when True, and the
 /// grid being stored on disk when False. </param>
 /// <param name="fileType">Optional. The grid file type.</param>
 /// <param name="cBack">Optional. The ICallback object that will receive the progress and error events during the creation of the new grid.</param>
 /// <returns>A boolean value representing the success or failure of the creation of the new grid.</returns>
 public bool CreateNew(string Filename, GridHeader Header, GridDataType DataType, object InitialValue, bool InRam, GridFileType fileType, ICallback cBack)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 18
0
 /// <summary>
 /// Rasterizes the network into a D8 grid.
 /// </summary>
 /// <param name="UseNetworkBounds">A boolean value representing whether the shape network bounds will be used as the only
 /// bounds for the D8 grid or not. </param>
 /// <param name="Header">Optional. A grid header to use to create the new grid.</param>
 /// <param name="Cellsize">Optional. The cell size to use in creating the D8 grid.</param>
 /// <param name="cBack">Optional. The ICallback object which will receive progress and error messages when the grid is being created.</param>
 /// <returns>Optional. The rasterized Grid representing the shape network.</returns>
 public Grid RasterizeD8(bool UseNetworkBounds, GridHeader Header, double Cellsize, ICallback cBack)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 19
0
        private GridHeader ReadGridHeader(StreamReader reader)
        {
            var header = new GridHeader();

            int i = 0;

            string line;

            var format = CultureInfo.InvariantCulture.NumberFormat;

            while (i < EXPECTED_SREC && (line = reader.ReadLine()) != null)
            {
                if (string.IsNullOrEmpty(line))
                {
                    continue;
                }

                string key = line.Substring(0, 8).Trim().ToUpperInvariant();

                string value = line.Substring(8).Trim();

                switch (key)
                {
                case "SUB_NAME":
                    header.SUB_NAME = value;
                    break;

                case "PARENT":
                    header.PARENT = value;
                    break;

                case "CREATED":
                    header.CREATED = value;
                    break;

                case "UPDATED":
                    header.UPDATED = value;
                    break;

                case "S_LAT":
                    header.S_LAT = double.Parse(value, format);
                    break;

                case "N_LAT":
                    header.N_LAT = double.Parse(value, format);
                    break;

                case "E_LONG":
                    header.E_LONG = double.Parse(value, format);
                    break;

                case "W_LONG":
                    header.W_LONG = double.Parse(value, format);
                    break;

                case "LAT_INC":
                    header.LAT_INC = double.Parse(value, format);
                    break;

                case "LONG_INC":
                    header.LONG_INC = double.Parse(value, format);
                    break;

                case "GS_COUNT":
                    header.GS_COUNT = int.Parse(value);
                    break;

                default:
                    break;
                }

                i++;
            }

            if (i != EXPECTED_SREC)
            {
                throw new FormatException("Invalid sub-grid header.");
            }

            return(header);
        }
Exemplo n.º 20
0
 private void ProcessObject(PSObject input)
 {
     if (this.windowProxy.IsWindowClosed())
     {
         LocalPipeline currentlyRunningPipeline = (LocalPipeline) base.Context.CurrentRunspace.GetCurrentlyRunningPipeline();
         if ((currentlyRunningPipeline != null) && !currentlyRunningPipeline.IsStopping)
         {
             currentlyRunningPipeline.StopAsync();
         }
     }
     else
     {
         object baseObject = input.BaseObject;
         if (((baseObject is ScriptBlock) || (baseObject is SwitchParameter)) || (((baseObject is PSReference) || (baseObject is FormatInfoData)) || (baseObject is PSObject)))
         {
             ErrorRecord errorRecord = new ErrorRecord(new FormatException(StringUtil.Format(FormatAndOut_out_gridview.DataNotQualifiedForGridView, new object[0])), "DataNotQualifiedForGridView", ErrorCategory.InvalidType, null);
             base.ThrowTerminatingError(errorRecord);
         }
         if (this.gridHeader == null)
         {
             this.windowProxy.ShowWindow();
             this.gridHeader = GridHeader.ConstructGridHeader(input, this);
         }
         else
         {
             this.gridHeader.ProcessInputObject(input);
         }
         Exception lastException = this.windowProxy.GetLastException();
         if (lastException != null)
         {
             ErrorRecord record2 = new ErrorRecord(lastException, "ManagementListInvocationException", ErrorCategory.OperationStopped, null);
             base.ThrowTerminatingError(record2);
         }
     }
 }
Exemplo n.º 21
0
        /// <summary>
        /// Execute formatting on a single object
        /// </summary>
        /// <param name="input">object to process</param>
        private void ProcessObject(PSObject input)
        {
            // Make sure the OGV window is not closed.
            if (_windowProxy.IsWindowClosed())
            {
                LocalPipeline pipeline = (LocalPipeline)this.Context.CurrentRunspace.GetCurrentlyRunningPipeline();

                if (pipeline != null && !pipeline.IsStopping)
                {
                    // Stop the pipeline cleanly.
                    pipeline.StopAsync();
                }
                return;
            }

            Object baseObject = input.BaseObject;

            // Throw a terminating error for types that are not supported.
            if (baseObject is ScriptBlock ||
                baseObject is SwitchParameter ||
                baseObject is PSReference ||
                baseObject is FormatInfoData ||
                baseObject is PSObject)
            {
                ErrorRecord error = new ErrorRecord(
                    new FormatException(StringUtil.Format(FormatAndOut_out_gridview.DataNotQualifiedForGridView)),
                    DataNotQualifiedForGridView,
                    ErrorCategory.InvalidType,
                    null);

                this.ThrowTerminatingError(error);
            }

            if (_gridHeader == null)
            {
                // Columns have not been added yet; Start the main window and add columns.
                _windowProxy.ShowWindow();
                _gridHeader = GridHeader.ConstructGridHeader(input, this);
            }
            else
            {
                _gridHeader.ProcessInputObject(input);
            }

            // Some thread synchronization needed.
            Exception exception = _windowProxy.GetLastException();
            if (exception != null)
            {
                ErrorRecord error = new ErrorRecord(
                    exception,
                    "ManagementListInvocationException",
                    ErrorCategory.OperationStopped,
                    null);

                this.ThrowTerminatingError(error);
            }
        }