website templates free download

Embedded сommands


The functionality of the GIS-ABP can be extended through built-in commands. To create an embedded command, you need the Microsoft Visual Studio development environment and the C # programming language.
 
Create an embedded command
• Launch Microsoft Visual Studio;
• Create a class library .Net Framework;
• Add a static class to the library;
• Add links to the DeltaLogic.dll and ObjectLibrary.dll libraries (the libraries are in the application directory, for example, C:\Program Files (x86)\ABP\GIS-ABP or C:\inetpub\wwwroot\GISABPServer);
• Add a property of the static class:
    public static DeltaLogic.UIProcessor oUIProcessor { get; set; }
• Create an extension for one of the DeltaLogic or ObjectLibrary library classes;
• Compile and copy the DLL to the folder specified in the LibFolder parameter (if the library is created for the client application, the parameter is in its settings, if for the server, the parameter is in the Web Services configuration file).
 
An example of an embedded command that includes several map layers:
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ObjectLibrary;
using DeltaLogic;
using System.ComponentModel;
namespace GISCommands
{
    public static class GISCommands
    {
 
        public static DeltaLogic.UIProcessor oUIProcessor { get; set; }
 
        [Description("RUSSIAN:Слои;ENGLISH:Layers[@Mode:Developer]")]
        public static void Layers(this Machine currentMachine)
        {
            oUIProcessor.SwitchAllLayersOff();
            oUIProcessor.FullScreenMode();
            oUIProcessor.SwitchLayerOn("Реки");
            oUIProcessor.SwitchLayerOn("Дороги");
            oUIProcessor.SwitchLayerOn("Города");
        }
    }
}
 
An oUIProcessor object of type DeltaLogic.UIProcessor is required to interact with the interface. It allows you to display messages, turn layers on and off, and work with user input (geometry and attributes). The functionality of DeltaLogic.UIProcessor is constantly being developed, and if you are missing a command, contact us at info@abpsoft.spb.ru and we will try to add the missing functionality.
 
Each static class can contain several procedures (extensions), each of which becomes available in the context menu of the GIS-ABP application when you right-click on the selected map or tree object. If the extension is created for the Machine class, the extension will work when the root object of the tree is selected (Machine), if the extension is created for the DataObject class, the extension will work for the selected map or tree object.
 
The attribute [Description ("RUSSIAN: Layers; ENGLISH: Layers [@Mode: Developer]")] means the following:
Depending on the value of the Language parameter, the name of the Layers or Layers command appears in the context menu. The command will work only for the application modes Developer and Administrator. In Operator mode, this command will not be available.
 
When creating additional functionality, objects of the DeltaLogic and ObjecLibrary library classes are used, grouped in a hierarchical tree. The structure of this hierarchical tree is reproduced by the tree of objects of the GIS-ABP application.
 
Each of the classes of the hierarchical tree of GIS-UPS objects implements the IObject interface, the main methods of which are Update () and Delete (). When calling the Update () and Delete () methods, data files are automatically updated.
 
In the event that a large number of DataObjects are loading, you can use the ObjectLibrary.TransactionManager class, which allows you to work with transactions - this significantly increases the performance when loading large amounts of data.
 
An example of an embedded command that allows you to study the mechanism of working with data files, and can also be used when loading data from other formats.
 
[Description("RUSSIAN:Копировать объекты в другой слой;ENGLISH:Copy objects to another layer[@Mode:Developer]")]
public static void CopyObjectsToAnotherLayer(this DataFile currentDataFile)
{
    TransactionManager oTransactionManager = new TransactionManager();
    oTransactionManager.OpenTransaction();
    Machine currentMachine = new Machine();
    string currentTargetLayerName = oUIProcessor.SelectValueString(currentMachine.DataFiles.Select(A => A.ID.ToString()).ToList(), "Выберите целовой слой для копирования");
    DataFile currentTargetDataFile = currentMachine.DataFiles.FirstOrDefault(A => A.ID.ToString() == currentTargetLayerName);
    List<int> IDList = new List<int>();
    DeltaList<DeltaLogic.Point> points = oUIProcessor.InputArea((Utils.GetSettingValue("Language").ToString().ToUpper() == "RUSSIAN")
        ? "Выделите область."
        : "Please select area.");
    CS gCS = oUIProcessor.GetWiorkspaceCoordinateSystem();
    DeltaList<DeltaLogic.PointXYZ> progectionPoints = new DeltaList<PointXYZ>(points.Select(A => gCS.CSToProjection(A)));
    DeltaLogic.Geometry boundingBox = (new DeltaLogic.Geometry(gCS, GeometryType.AREA, new DeltaLogic.DeltaList<Point>(points))).BoundingBox;
 
    foreach (DataObject currentDataObject in currentDataFile
        .Shapes
        .Where(A => A.Boundary.RectanglesIntersect(boundingBox))
        .SelectMany(A => A.DataObjects))
    {
         if (currentDataObject.Properties.Any(A => A.ObjectGeometry != null))
        {
            if (currentDataObject.Properties.FirstOrDefault(A => A.ObjectGeometry != null).ObjectGeometry.Points.Any(Q => ((PointXYZ)Q).IsInsidePolygon(progectionPoints)))
            {
                if (!IDList.Contains((int)currentDataObject.ID))
                {
                    IDList.Add((int)currentDataObject.ID);
                    DataObject newDataObject = new DataObject(currentDataObject.Properties);
                    newDataObject.Parent = currentTargetDataFile;
                    newDataObject.Update();
                }
            }
        }
    }
    oTransactionManager.CommitTransaction();
}

ADDRESS

192148, Russian Federation, St. Petersburg, Autogennaya street,
house 10, office 422/3

CONTACT

Tel +7(921) 862-98-09
Email: info@abpsoft.spb.ru