Пример #1
0
    public Arml CreateARMLElements(string prefab, string id, GeoLocation geo, float compass, float viewArc)
    {
        createdTrackables = new List <TrackableElement>();
        createdViewPoints = new List <ViewPointElement>();
        createdSectors    = new List <SectorElement>();
        createdFeatures   = new List <FeatureElement>();

        creationTrackable = new TrackableElement();
        creationSector    = new SectorElement();
        creationViewPoint = new ViewPointElement();
        creationFeature   = new FeatureElement();

        SetTrackableElement(id);
        SetSectorElement(id, creationTrackable, compass, viewArc);
        SetViePointElement(id, creationSector, geo);
        SetFeatureElement(id, creationTrackable, prefab);

        createdTrackables.Add(creationTrackable);
        createdSectors.Add(creationSector);
        createdViewPoints.Add(creationViewPoint);
        createdFeatures.Add(creationFeature);

        arml                       = new Arml();
        arml.aRElements            = new ARElements();
        arml.aRElements.Trackables = createdTrackables;
        arml.aRElements.Sectors    = createdSectors;
        arml.aRElements.ViewPoints = createdViewPoints;
        arml.aRElements.Features   = createdFeatures;

        createdArmls.Add(arml);

        return(arml);
    }
        private static BasicToggleType CreateToggleType(FeatureElement feature, IUserListReader userListReader)
        {
            BasicToggleType toggleType;

            // The toggle is disabled by default, so if HasValue is false, then toggle is disabled.
            bool enabled = feature.Enabled.HasValue && feature.Enabled.Value;

            if (!string.IsNullOrEmpty(feature.UserListPath))
            {
                var userList = userListReader.GetUserNamesFromList(feature.UserListPath);
                toggleType = new UserListToggleType {
                    Name = feature.Name, Enabled = enabled, UserNamesList = userList
                };
            }
            else if (!string.IsNullOrEmpty(feature.RandomFactor))
            {
                // Convert string to float
                float factorValue = float.Parse(feature.RandomFactor, CultureInfo.InvariantCulture.NumberFormat);
                toggleType = new RandomToggleType {
                    Name = feature.Name, Enabled = enabled, RandomFactor = factorValue
                };
            }
            else
            {
                toggleType = new BasicToggleType {
                    Name = feature.Name, Enabled = enabled
                };
            }

            return(toggleType);
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (cmbLayers.SelectedItem != null)
            {
                var fs = (cmbLayers.SelectedItem as FeatureMapLayer).DataSet;
                _Package.Feature = fs;
                FeatureElement fe = new FeatureElement()
                {
                    FeatureFilename = fs.Filename,
                    FeatureName     = fs.Name,
                    PackageName     = _Package.Name
                };

                var ff = from fea in _FeaElements where fea.FeatureFilename == fe.FeatureFilename select fea;
                if (ff.Count() > 0)
                {
                    _FeaElements.Remove(ff.First());
                    _FeaElements.Add(fe);
                }
                else
                {
                    _FeaElements.Add(fe);
                }
            }
            this.Close();
        }
        private FeatureConfiguration GetConfiguration(IFeature feature, bool featureConfigurationIsEnabled)
        {
            var featureElement = new FeatureElement { Name = feature.Name, IsEnabled = featureConfigurationIsEnabled };

            var featureSet = new Mock<FeatureElementsCollection>();
            featureSet.Setup(s => s.GetEnumerator()).Returns(new List<FeatureElement> { featureElement }.GetEnumerator());

            return new FeatureConfiguration { Features = featureSet.Object };
        }
Пример #5
0
 private void CreateEntities(Feature feature, FeatureElement element)
 {
     element.Trackables.ForEach(t => AddTrackableLink(t, feature));
     element.Assets.ForEach(a => CreateAsset(a, feature));
     element.anchors.ForEach(a => CreateAnchor(a, feature));
     //
     element.Annotations.ForEach(a => CreateAnnotation(a, feature));
     //
     FeatureReady(this, new EventArg <Feature>(feature));
 }
        private FeatureConfiguration GetConfiguration(IFeature feature, bool featureConfigurationIsEnabled)
        {
            var featureElement = new FeatureElement {
                Name = feature.Name, IsEnabled = featureConfigurationIsEnabled
            };

            var featureSet = new Mock <FeatureElementsCollection>();

            featureSet.Setup(s => s.GetEnumerator()).Returns(new List <FeatureElement> {
                featureElement
            }.GetEnumerator());

            return(new FeatureConfiguration {
                Features = featureSet.Object
            });
        }