Exemplo n.º 1
0
        private static IEnumerable <Reference> RequestReferenceSelection(
            string message, ILogger logger, SelectionObjectType selectionType)
        {
            var doc = DocumentManager.Instance.CurrentUIDocument;

            Reference reference = null;

            var choices = doc.Selection;

            choices.Elements.Clear();

            logger.Log(message);

            switch (selectionType)
            {
            case SelectionObjectType.Face:
                reference = doc.Selection.PickObject(ObjectType.Face, message);
                break;

            case SelectionObjectType.Edge:
                reference = doc.Selection.PickObject(ObjectType.Edge, message);
                break;

            case SelectionObjectType.PointOnFace:
                reference = doc.Selection.PickObject(ObjectType.PointOnElement, message);
                break;
            }

            return(reference == null ? null : new List <Reference> {
                reference
            });
        }
Exemplo n.º 2
0
 protected RevitSelection(SelectionType selectionType,
                          SelectionObjectType selectionObjectType, string message, string prefix)
     : base(selectionType, selectionObjectType, message, prefix)
 {
     RevitServicesUpdater.Instance.ElementsUpdated   += Updater_ElementsUpdated;
     DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged;
 }
Exemplo n.º 3
0
 public SteelSelection(SelectionType selectionType,
                       SelectionObjectType selectionObjectType, string message, string prefix,
                       IEnumerable <string> selectionIdentifier, IEnumerable <PortModel> inPorts, IEnumerable <PortModel> outPorts)
     : base(selectionType, selectionObjectType, message, prefix, selectionIdentifier, inPorts, outPorts)
 {
     AppResolver.Resolve <IAppInteraction>().DocumentOpened += Controller_DocumentChanged;
 }
Exemplo n.º 4
0
        private static IEnumerable <Reference> RequestMultipleReferencesSelection(
            string message, ILogger logger, SelectionObjectType selectionType)
        {
            var doc = DocumentManager.Instance.CurrentUIDocument;

            IList <Reference> references = null;

            var choices = doc.Selection;

            choices.Elements.Clear();

            logger.Log(message);

            switch (selectionType)
            {
            case SelectionObjectType.Face:
                references = doc.Selection.PickObjects(ObjectType.Face, message);
                break;

            case SelectionObjectType.Edge:
                references = doc.Selection.PickObjects(ObjectType.Edge, message);
                break;

            case SelectionObjectType.PointOnFace:
                references = doc.Selection.PickObjects(ObjectType.PointOnElement, message);
                break;
            }

            if (references == null || !references.Any())
            {
                return(null);
            }

            return(references);
        }
Exemplo n.º 5
0
 public RevitSelection(SelectionType selectionType,
                       SelectionObjectType selectionObjectType, string message, string prefix,
                       IEnumerable <string> selectionIdentifier, IEnumerable <PortModel> inPorts, IEnumerable <PortModel> outPorts)
     : base(selectionType, selectionObjectType, message, prefix, selectionIdentifier, inPorts, outPorts)
 {
     RevitServicesUpdater.Instance.ElementsUpdated   += Updater_ElementsUpdated;
     DynamoRevitApp.EventHandlerProxy.DocumentOpened += Controller_RevitDocumentChanged;
 }
Exemplo n.º 6
0
 public static VirtualCell.CellType[] GetCellTypes(SelectionObjectType selection_type)
 {
     if (selectionDict == null)
     {
         CreateSelectionDictionary();
     }
     return(selectionDict[selection_type]);
 }
Exemplo n.º 7
0
        public void GetSelectionOutputTest(SelectionObjectType selectionObjectType, SelectionType selectinType, string expectedResult)
        {
            selection = new SelectionConcrete(selectinType, selectionObjectType, "testMessage", "testPrefix");

            var result = selection.GetOutputPortName();

            Assert.AreEqual(expectedResult, result);
        }
Exemplo n.º 8
0
        /* TODO: Now that nodes know nothing about their owners, we can't access RunEnabled.
         * public override bool CanSelect
         * {
         *  get { return base.CanSelect && RevitDynamoModel.RunEnabled; }
         *  set { base.CanSelect = value; }
         * }
         *
         * public override string SelectionSuggestion
         * {
         *  get
         *  {
         *      return RevitDynamoModel.RunEnabled
         *          ? base.SelectionSuggestion
         *          : "Selection is disabled when Dynamo run is disabled.";
         *  }
         * }
         *
         * /// <summary>
         * /// Handler for the RevitDynamoModel's PropertyChanged event.
         * /// </summary>
         * /// <param name="sender"></param>
         * /// <param name="e"></param>
         * private void revMod_PropertyChanged(object sender, PropertyChangedEventArgs e)
         * {
         *  // Use the RunEnabled flag on the dynamo model
         *  // to set the CanSelect flag, enabling or disabling
         *  // any bound UI when the dynamo model is not
         *  // in a runnable state.
         *  if (e.PropertyName == "RunEnabled")
         *  {
         *      RaisePropertyChanged("CanSelect");
         *      RaisePropertyChanged("SelectionSuggestion");
         *  }
         * }
         */

        #endregion

        #region protected constructors

        protected RevitSelection(SelectionType selectionType,
                                 SelectionObjectType selectionObjectType, string message, string prefix)
            : base(selectionType, selectionObjectType, message, prefix)
        {
            RevitServicesUpdater.Instance.ElementsDeleted  += Updater_ElementsDeleted;
            RevitServicesUpdater.Instance.ElementsModified += Updater_ElementsModified;
            DocumentManager.Instance.CurrentUIApplication.Application.DocumentOpened += Controller_RevitDocumentChanged;
            //revMod.PropertyChanged += revMod_PropertyChanged;
        }
Exemplo n.º 9
0
        public XafBootstrapTable()
        {
            SelectionType   = SelectionObjectType.None;
            SelectedObjects = new List <object>();
            CustomColumns   = new List <HeaderInfo>();

            Content = new Control();
            Controls.Add(Content);

            ClientSideEvents = new StaticEditClientSideEvents();
        }
Exemplo n.º 10
0
 public SelectionConcrete(
     SelectionType selectionType,
     SelectionObjectType selectionObjectType,
     string message,
     string prefix)
     : base(
         selectionType,
         selectionObjectType,
         message,
         prefix)
 {
 }
Exemplo n.º 11
0
 //This constructor is only used during testing to allow the initialization of the SelectionHelper property
 public SelectionConcrete(
     SelectionType selectionType,
     SelectionObjectType selectionObjectType,
     string message,
     string prefix,
     IModelSelectionHelper <ModelBase> selectionHelper)
     : base(
         selectionType,
         selectionObjectType,
         message,
         prefix)
 {
     SelectionHelper = selectionHelper;
 }
Exemplo n.º 12
0
 public void RemoveCellInstancesOfTypesInSelection(SelectionObjectType sop)
 {
     foreach (VirtualCell.CellType t in SelectionManager.GetCellTypes(sop))
     {
         List <CellInstance> tmp_list = new List <CellInstance>(this.instances);
         foreach (CellInstance ci in tmp_list)
         {
             if (ci.type == t)
             {
                 RemoveCellInstance(ci);
             }
         }
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// Request an element in a selection.
        /// </summary>
        /// <typeparam name="T">The type of the Element.</typeparam>
        /// <param name="selectionMessage">The message to display.</param>
        /// <param name="selectionType">The selection type.</param>
        /// <param name="objectType">The selection object type.</param>
        /// <returns></returns>
        public IEnumerable <T> RequestSelectionOfType(
            string selectionMessage, SelectionType selectionType, SelectionObjectType objectType)
        {
            switch (selectionType)
            {
            case SelectionType.One:
                return(RequestElementSelection(selectionMessage, AsLogger()));

            case SelectionType.Many:
                return(RequestMultipleElementsSelection(selectionMessage, AsLogger()));
            }

            return(null);
        }
Exemplo n.º 14
0
        public IEnumerable <Reference> RequestSelectionOfType(
            string selectionMessage, SelectionType selectionType, SelectionObjectType objectType)
        {
            switch (selectionType)
            {
            case SelectionType.One:
                return(RequestReferenceSelection(selectionMessage, AsLogger(), objectType));

            case SelectionType.Many:
                return(RequestMultipleReferencesSelection(selectionMessage, AsLogger(), objectType));
            }

            return(null);
        }
Exemplo n.º 15
0
    private List <GameObject> SelectInternal(PhysicalMap physicalMap, SelectionObjectType type)
    {
        if (physicalMap == null)
        {
            Debug.Log("NO PHYSICAL MAP!");
            return(null);
        }

        DaedalusDebugUtils.Assert(physicalMap.gameObjectLists != null, "Physical map's game object lists are null!");

        List <GameObject> list = physicalMap.GetObjectsOfType(type) as List <GameObject>;

        if (list.Count == 0)
        {
            Debug.Log("NO ITEMS!");
            return(list);
        }

        if (OVERRIDE_MATERIALS)
        {
            Material currentMat = list[0].GetComponentsInChildren <MeshRenderer>()[0].sharedMaterial;

            if (originalMaterials.ContainsKey(type) && originalMaterials[type] != null)
            {
                // Already selected!
                return(list);
            }
            else
            {
                originalMaterials[type] = currentMat;
            }

            Material sharedMat = new Material(currentMat);
            sharedMat.color = Color.blue;
            sharedMat.name  = "Debug Material";
            foreach (GameObject go in list)
            {
                foreach (MeshRenderer r in go.GetComponentsInChildren <MeshRenderer>())
                {
                    r.sharedMaterial = sharedMat;
                }
            }
        }
        return(list);
    }
Exemplo n.º 16
0
 public SelectionConcrete(
     SelectionType selectionType,
     SelectionObjectType selectionObjectType,
     string message,
     string prefix,
     IEnumerable <string> selectionIdentifier,
     IEnumerable <PortModel> inPorts,
     IEnumerable <PortModel> outPorts)
     : base(
         selectionType,
         selectionObjectType,
         message,
         prefix,
         selectionIdentifier,
         inPorts,
         outPorts)
 {
 }
Exemplo n.º 17
0
        protected SelectionBase(WorkspaceModel workspaceModel,
                                SelectionType selectionType,
                                SelectionObjectType selectionObjectType,
                                string message,
                                string prefix)
            : base(workspaceModel)
        {
            selectionMessage = message;

            this.selectionType       = selectionType;
            this.selectionObjectType = selectionObjectType;

            OutPortData.Add(new PortData("Elements", "The selected elements."));
            RegisterAllPorts();

            SelectCommand = new DelegateCommand(Select, CanBeginSelect);
            Prefix        = prefix;
        }
Exemplo n.º 18
0
    private void ClearList(PhysicalMap physicalMap, SelectionObjectType type)
    {
        List <GameObject> list = physicalMap.GetObjectsOfType(type);

        if (OVERRIDE_MATERIALS)
        {
            if (originalMaterials.ContainsKey(type) && originalMaterials[type] != null)
            {
                foreach (GameObject go in list)
                {
                    foreach (MeshRenderer r in go.GetComponentsInChildren <MeshRenderer>())
                    {
                        r.sharedMaterial = originalMaterials[type];
                    }
                }
                originalMaterials[type] = null;
            }
        }
    }
Exemplo n.º 19
0
        protected SelectionBase(
            SelectionType selectionType,
            SelectionObjectType selectionObjectType,
            string message,
            string prefix)
        {
            selectionMessage = message;

            this.selectionType       = selectionType;
            this.selectionObjectType = selectionObjectType;

            OutPortData.Add(new PortData("Elements", Resources.SelectionPortDataResultToolTip));
            RegisterAllPorts();

            Prefix = prefix;

            State = ElementState.Warning;

            ShouldDisplayPreviewCore = false;
        }
Exemplo n.º 20
0
        protected SelectionBase(
            SelectionType selectionType,
            SelectionObjectType selectionObjectType,
            string message,
            string prefix)
        {
            selectionMessage = message;

            this.selectionType       = selectionType;
            this.selectionObjectType = selectionObjectType;

            OutPortData.Add(new PortData("Elements", "The selected elements."));
            RegisterAllPorts();

            SelectCommand = new DelegateCommand(Select, CanBeginSelect);
            Prefix        = prefix;

            State = ElementState.Warning;

            ShouldDisplayPreviewCore = false;
        }
Exemplo n.º 21
0
        protected RevitSelection(
            WorkspaceModel workspaceModel, SelectionType selectionType,
            SelectionObjectType selectionObjectType, string message, string prefix)
            : base(workspaceModel, selectionType, selectionObjectType, message, prefix)
        {
            Logger = workspaceModel.DynamoModel.Logger;

            RevitDynamoModel = Workspace.DynamoModel as RevitDynamoModel;

            // we need to obtain the dynamo model directly from the workspace model
            // here, as it is not yet initialized on the base constructor
            var revMod = workspaceModel.DynamoModel as RevitDynamoModel;

            if (revMod == null)
            {
                return;
            }

            revMod.RevitServicesUpdater.ElementsDeleted  += Updater_ElementsDeleted;
            revMod.RevitServicesUpdater.ElementsModified += Updater_ElementsModified;
            revMod.RevitDocumentChanged += Controller_RevitDocumentChanged;
            revMod.PropertyChanged      += revMod_PropertyChanged;
        }
Exemplo n.º 22
0
        protected SelectionBase(
            SelectionType selectionType,
            SelectionObjectType selectionObjectType,
            string message,
            string prefix)
        {
            selectionMessage = message;

            this.selectionType       = selectionType;
            this.selectionObjectType = selectionObjectType;

            string portName = GetOutputPortName();

            OutPorts.Add(new PortModel(PortType.Output, this, new PortData(portName, Resources.SelectionPortDataResultToolTip)));

            RegisterAllPorts();

            Prefix = prefix;

            State = ElementState.Warning;

            ShouldDisplayPreviewCore = true;
        }
Exemplo n.º 23
0
        protected SelectionBase(
            SelectionType selectionType,
            SelectionObjectType selectionObjectType,
            string message,
            string prefix,
            IEnumerable <string> selectionIdentifier,
            IEnumerable <PortModel> inPorts,
            IEnumerable <PortModel> outPorts) : base(inPorts, outPorts)
        {
            selectionMessage = message;

            this.selectionType       = selectionType;
            this.selectionObjectType = selectionObjectType;

            Prefix = prefix;

            State = ElementState.Warning;

            ShouldDisplayPreviewCore = true;

            SelectionIdentifier = selectionIdentifier;
            ResetSelectionFromIds(SelectionIdentifier.ToList());
        }
Exemplo n.º 24
0
 protected ElementSelection(SelectionType selectionType,
                            SelectionObjectType selectionObjectType, string message, string prefix,
                            IEnumerable <string> selectionIdentifier, IEnumerable <PortModel> inPorts, IEnumerable <PortModel> outPorts)
     : base(selectionType, selectionObjectType, message, prefix, selectionIdentifier, inPorts, outPorts)
 {
 }
Exemplo n.º 25
0
        public IEnumerable <string> RequestSelectionOfType(string selectionMessage, SelectionType selectionType, SelectionObjectType objectType)
        {
            IAppInteraction appInteraction = AppResolver.Resolve <IAppInteraction>();
            Point3d         pt             = appInteraction.PickPoint();

            return(new string[] { string.Format("{0};{1};{2}", pt.x, pt.y, pt.z) });
        }
Exemplo n.º 26
0
    public List <GameObject> SelectObjects(SelectionObjectType type)
    {
        PhysicalMap physicalMap = generator.physicalMap;

        return(SelectInternal(physicalMap, type));
    }
Exemplo n.º 27
0
 protected ReferenceSelection(
     WorkspaceModel workspaceModel, SelectionType selectionType,
     SelectionObjectType selectionObjectType, string message, string prefix)
     : base(workspaceModel, selectionType, selectionObjectType, message, prefix)
 {
 }
Exemplo n.º 28
0
        public IEnumerable <string> RequestSelectionOfType(string selectionMessage, SelectionType selectionType, SelectionObjectType objectType)
        {
            IAppInteraction appInteraction = AppResolver.Resolve <IAppInteraction>();
            var             descs          = appInteraction.PickElements();

            return(descs);
        }
Exemplo n.º 29
0
 protected ElementSelection(SelectionType selectionType,
                            SelectionObjectType selectionObjectType, string message, string prefix)
     : base(selectionType, selectionObjectType, message, prefix)
 {
 }
Exemplo n.º 30
0
 protected ReferenceSelection(SelectionType selectionType,
                              SelectionObjectType selectionObjectType, string message, string prefix)
     : base(selectionType, selectionObjectType, message, prefix)
 {
 }