コード例 #1
0
        /// <summary>
        /// Create map tools for barriers.
        /// </summary>
        private void _CreateBarrierTools()
        {
            _pointTool = new BarrierPointTool();
            _pointTool.OnComplete += new EventHandler(_PointToolOnComplete);
            _polygonTool = new BarrierPolygonTool();
            _polygonTool.OnComplete += new EventHandler(_PolygonToolOnComplete);
            _polylineTool = new BarrierPolylineTool();
            _polylineTool.OnComplete += new EventHandler(_PolylineToolOnComplete);

            // Add tools.
            List<IMapTool> tools = new List<IMapTool>();
            tools.Add(_pointTool);
            tools.Add(_polylineTool);
            tools.Add(_polygonTool);

            _mapCtrl.AddTools(tools.ToArray(), _CanActivateBarrierTool);
        }
コード例 #2
0
        /// <summary>
        /// Create RegionsPage.
        /// </summary>
        /// <param name="mapCtrl">Map from parent page.</param>
        /// <param name="dataGridControl">Grid from parent page.</param>
        /// <param name="parentLayer">Layer, that contains regions.</param>
        /// <param name="type">Semantic type of regions. Barrier or Zone.</param>
        /// <param name="layoutRoot">Parent page layout root.</param>
        /// <param name="mapBorder">Container element for map.</param>
        public RegionsPage(MapControl mapCtrl, DataGridControlEx dataGridControl, ObjectLayer parentLayer,
            Type type, Grid layoutRoot, Border mapBorder)
        {
            _mapCtrl = mapCtrl;
            _mapCtrl.CanSelectCallback = _CanSelect;
            _mapCtrl.StartEditRegionCallback = _EditStarted;
            _mapCtrl.EndEditRegionCallback = _EditEnded;

            _dataGridControl = dataGridControl;

            _parentLayer = parentLayer;

            _type = type;

            if (_type == typeof(Zone))
            {
                _polygonTool = new ZonePolygonTool();
                _polygonTool.OnComplete += new EventHandler(_PolygonToolOnComplete);
                _mapCtrl.AddTool(_polygonTool, _CanActivateZonePolygonTool);
            }
            else if (_type == typeof(Barrier))
            {
                _CreateBarrierTools();
            }
            else
                Debug.Assert(false);

            _gridAutoFitHelper = new GridAutoFitHelper(dataGridControl, layoutRoot, mapBorder);
        }