public VeloObjectInfoView(VeloObject veloobject, IVeloObjectManager soManager)
 {
     InitializeComponent();
     _veloobjectManager = soManager;
     VeloObject         = veloobject;
     _isEdit            = !VeloObject.IsTransient();
 }
        public VeloObjectEditView(VeloObject veloobject, IVeloObjectManager soManager)
        {
            InitializeComponent();

            cB_Type.DataSource = Enum.GetValues(typeof(VeloType)).Cast <VeloType>()
                                 .Select(t => VeloTypeStrings.GetString(t)).ToList();

            /* cB_View.DataSource = Enum.GetValues(typeof(VeloView)).Cast<VeloView>()
             *   .Select(t => VeloViewStrings.GetString(t)).ToList(); */

            /* cB_Status.DataSource = Enum.GetValues(typeof(VeloObjectStatus)).Cast<VeloObjectStatus>()
             *   .Select(t => VeloObjectStatusStrings.GetStatusName(t)).ToList(); */


            _veloobjectManager = soManager;
            VeloObject         = veloobject;
            _isEdit            = !VeloObject.IsTransient();
        }
Exemple #3
0
 public VeloObjectSummaryPresenter(IVeloObjectManager VeloObjectManager)
 {
     _VeloObjectManager = VeloObjectManager;
 }
Exemple #4
0
 public VeloObjectLayerLoader()
 {
     _veloobjectManager = VeloObjectConstants.Container.Resolve <IVeloObjectManager>();
 }
Exemple #5
0
        public static VeloObject GetSelectedVeloObject(IMap handledMap, IVeloObjectManager VeloObjectManager,
                                                       Coordinate coord, VeloObject currentVeloObject, out InfoOfFeature info)
        {
            VeloObject choosenVeloObject = null;
            var        list = handledMap.GetAllFeature(coord, VeloObjectConstants.VeloObjectLayerAlias)
                              // Выбираем те фичи, у которых нет атрибута видимости (тогда они видимые) или он есть и его значение true.
                              .Where(i => i.Feature.Attributes.All(a => a.AttrType.Name != "IsVisible") ||
                                     ((Attribute <bool>)i.Feature.Attributes.First(a => a.AttrType.Name == "IsVisible"))
                                     .AttrValue).ToList();
            var listPoints = handledMap.GetAllFeature(coord, 20)
                             .Where(i => i.LayerAlias == VeloObjectConstants.VeloObjectLayerAlias)
                             .Where(i => i.Feature.Geometry.GeometryType == "Point")
                             .Where(i => i.Feature.Attributes.All(a => a.AttrType.Name != "IsVisible") ||
                                    ((Attribute <bool>)i.Feature.Attributes.First(a => a.AttrType.Name == "IsVisible"))
                                    .AttrValue);

            foreach (var p in listPoints)
            {
                if (list.All(x => x.FeatureId != p.FeatureId))
                {
                    var attr = (Attribute <IGeometry>)p.Feature.Attributes.FirstOrDefault(a => a.AttrType.Name == "Boundary");
                    if (attr != null)
                    {
                        var polygon = new Polygon((ILinearRing)attr.AttrValue);

                        if (polygon.Intersects(new Point(coord)))
                        {
                            list.Add(p);
                        }
                    }
                }
            }
            var args = list.ToArray();

            if (args.Length == 0)
            {
                var tempFeatures = handledMap.GetAllFeature(coord, handledMap.TempLayerAlias);
                if (
                    tempFeatures.Any(
                        f =>
                        f.Feature.Attributes.Any(
                            a =>
                            a.AttrType.Name == "VeloObject" &&
                            ((Attribute <VeloObject>)a).AttrValue == currentVeloObject)))
                {
                    info = tempFeatures.First(
                        f =>
                        f.Feature.Attributes.Any(
                            a =>
                            a.AttrType.Name == "VeloObject" &&
                            ((Attribute <VeloObject>)a).AttrValue == currentVeloObject));
                    return(currentVeloObject);
                }
                info = null;
                return(null);
            }
            if (args.Length == 1)
            {
                //StateMachine.SelectFeatureAdd(args.First());
                info = args.First();
                choosenVeloObject = VeloObjectManager.GetByFeature(args.First().FeatureId);
            }
            //Если объектов в указанном месте несколько
            else
            {
                var VeloObjects =
                    args.Select(arg => VeloObjectManager.GetByFeature(arg.FeatureId))
                    .Where(x => x != null)
                    .ToList();
                var s = VeloObjects.Select(x => x.TypeAsString).ToList();
                var f = new SelectFeatureForm(s)
                {
                    Text = @"ITSGIS: выбор объекта"
                };
                if (f.ShowDialog() == DialogResult.OK && f.SelectedItem >= 0 && f.SelectedItem < args.Length)
                {
                    //StateMachine.SelectFeatureAdd(args[f.SelectedItem]);
                    info = args[f.SelectedItem];
                    choosenVeloObject = VeloObjectManager.GetByFeature(args[f.SelectedItem].FeatureId);
                }
                else
                {
                    info = null;
                }
            }
            return(choosenVeloObject);
        }