public async Task <string> DeleteUser(GraphObject graphObject)
        {
            var client   = new B2CGraphClient(clientId, clientSecret, tenant);
            var response = await client.DeleteUser(graphObject.UserId);

            return(response);
        }
        public async Task <string> UpdateFeedPreference(GraphObject graphObject)
        {
            var client   = new B2CGraphClient(clientId, clientSecret, tenant);
            var response = await client.UpdateUser(graphObject.UserId, graphObject.UserJsonData);

            return(response);
        }
Ejemplo n.º 3
0
        public void Update(T obj, GraphObject parent = null)
        {
            Type   thisType    = obj.GetType();
            string updateQuery = $"g.V('{obj.GraphKey}')";
            object currentValue;

            foreach (PropertyInfo propInfo in thisType.GetProperties())
            {
                if (propInfo.Name == "GraphKey")
                {
                    continue;
                }

                currentValue = propInfo.GetValue(obj);
                if ((Attributes.Edge)propInfo.GetCustomAttribute(typeof(Attributes.Edge)) != null)
                {
                    continue;
                }

                var edgeProperty = (EdgeProperty)propInfo.GetCustomAttribute(typeof(EdgeProperty));
                if (edgeProperty != null && parent != null)
                {
                    string updateEdgeQuery = $"g.E().has('_vertexId','{parent.GraphKey}').has('_sink', '{ obj.GraphKey }')";
                    updateEdgeQuery += getPropertyQuery(propInfo.Name, currentValue);
                    ExecuteCommandEdge(updateEdgeQuery);
                }
                else
                {
                    updateQuery += getPropertyQuery(propInfo.Name, currentValue);
                }
            }

            ExecuteCommandVertex(updateQuery);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets a list of <see cref="User"/> objects that a given <see cref="User"/> has as a direct report.
        /// </summary>
        /// <param name="objectId">Unique identifier of the <see cref="User"/>.</param>
        /// <returns>A view with the list of <see cref="User"/> objects.</returns>
        public ActionResult GetDirectReports(string objectId)
        {
            //Get the access token as we need it to make a call to the Graph API
            string accessToken = AuthUtils.GetAuthToken(Request, HttpContext);

            if (accessToken == null)
            {
                //
                // The user needs to re-authorize.  Show them a message to that effect.
                //
                ViewBag.ErrorMessage = "AuthorizationRequired";
                return(View());
            }

            // Setup Graph API connection and get Group membership
            Guid          ClientRequestId = Guid.NewGuid();
            GraphSettings graphSettings   = new GraphSettings();

            graphSettings.ApiVersion = GraphConfiguration.GraphApiVersion;
            GraphConnection graphConnection = new GraphConnection(accessToken, ClientRequestId, graphSettings);

            GraphObject         graphUser = graphConnection.Get <User>(objectId);
            IList <GraphObject> results   = graphConnection.GetAllDirectLinks(graphUser, LinkProperty.DirectReports);
            IList <User>        reports   = new List <User>();

            foreach (GraphObject obj in results)
            {
                if (obj is User)
                {
                    User user = (User)obj;
                    reports.Add(user);
                }
            }
            return(View(reports));
        }
Ejemplo n.º 5
0
        public T GetExtension <T>(GraphObject graphObject, T previous) where T : class
        {
            var graphNode = graphObject as GraphNode;

            if (graphNode != null)
            {
                // If this is not a Roslyn node, bail out.
                // TODO: The check here is to see if the SymbolId property exists on the node
                // and if so, that's been created by us. However, eventually we'll want to extend
                // this to other scenarios where C#\VB nodes that aren't created by us are passed in.
                if (graphNode.GetValue <SymbolKey?>(RoslynGraphProperties.SymbolId) == null)
                {
                    return(null);
                }

                if (typeof(T) == typeof(IGraphNavigateToItem))
                {
                    return(new GraphNavigatorExtension(PrimaryWorkspace.Workspace) as T);
                }

                if (typeof(T) == typeof(IGraphFormattedLabel))
                {
                    return(new GraphFormattedLabelExtension() as T);
                }
            }

            return(null);
        }
Ejemplo n.º 6
0
        private static void Main()
        {
            ICayleyClient client = new CayleyClient("http://localhost:64210/api/v1/query/gremlin");
            IGraphObject  g      = new GraphObject();
            IGremlinQuery query  = g.V().Has("name", "Casablanca")
                                   .Out("/film/film/starring")
                                   .Out("/film/performance/actor")
                                   .Out("name")
                                   .All();
            CayleyResponse response = client.Send(query);

            System.Console.WriteLine(response.Content);

            System.Console.WriteLine("--------------------------------------------------------------------------------");

            var           filmToActor       = g.Morphism().Out("/film/film/starring").Out("/film/performance/actor");
            IGremlinQuery queryWithMorphism = g.V()
                                              .Has("name", "Casablanca")
                                              .Follow(filmToActor)
                                              .Out("name")
                                              .All();
            CayleyResponse morpResponse = client.Send(queryWithMorphism);

            System.Console.WriteLine(morpResponse.Content);

            System.Console.WriteLine("--------------------------------------------------------------------------------");

            string         emitQuery    = g.Emit(new { name = "John Doe", age = 25, hasRoom = true });
            CayleyResponse emitResponse = client.Send(emitQuery);

            System.Console.WriteLine(emitResponse.Content);
            System.Console.ReadLine();
        }
Ejemplo n.º 7
0
        public EditionObject ChangerNoeud(GraphObject objetAjoute, string objetsupprimeGraphKey, string ViewModelProprieteNom, string graphModelProprieteNom, GraphObject noeudModifie)
        {
            var edition = FindEditionObjectOfType(
                viewModelProprieteNom: ViewModelProprieteNom,
                graphnoeud: noeudModifie,
                type: EditionObjectType.ChangementRelation,
                editionEtat: EditionObjectEtat.Modifie);

            if (edition != null)
            {
                edition.ObjetAjoute     = objetAjoute;
                edition.ObjetSupprimeId = objetsupprimeGraphKey;
                Update(edition);
                if (edition.ObjetAjoute != null)
                {
                    string deleteAjouteEdgeQuery = $"g.V('{edition.GraphKey}').outE('Ajoute').drop()";
                    ExecuteCommandQueryVertex(deleteAjouteEdgeQuery);
                    var att = (Edge)edition.GetType().GetProperty("ObjetAjoute").GetCustomAttribute(typeof(Edge));
                    CreateEdge(edition, edition.ObjetAjoute, att);
                }
            }
            else
            {
                edition = CreateEditionObject(
                    viewModelProprieteNom: ViewModelProprieteNom,
                    graphModelProprieteNom: graphModelProprieteNom,
                    objetAjoute: objetAjoute,
                    objetSupprimeId: objetsupprimeGraphKey,
                    noeudModifie: noeudModifie);
            };
            return(edition);
        }
Ejemplo n.º 8
0
 public Block(GraphObject obj1, GraphObject obj2)
     : base()
 {
     object1    = obj1;
     object2    = obj2;
     this.Width = this.Depth = 0.25;
 }
Ejemplo n.º 9
0
        private static void Example2()
        {
            var g = new Graph();

            g.Assert("http://person.com#bob", "http://schema.com#employer", "http://person.com#acme");
            g.Assert("http://person.com#bob", "http://schema.com#name", "http://person.com#bob/name");
            g.Assert("http://person.com#bob/name", "http://schema.com#first", GraphObject.FromData("Bob"));
            g.Assert("http://person.com#bob/name", "http://schema.com#second", GraphObject.FromData("Dylan"));
            g.Assert("http://person.com#leonard", "http://schema.com#employer", "http://person.com#acme");
            g.Assert("http://person.com#leonard", "http://schema.com#name", "http://person.com#leonard/name");
            g.Assert("http://person.com#leonard/name", "http://schema.com#first", GraphObject.FromData("Leonard"));
            g.Assert("http://person.com#leonard/name", "http://schema.com#second", GraphObject.FromData("Cohen"));

            //Console.WriteLine(JsonLdProcessor.Frame(new Context { Base = "http://schema.com#" }, data, "http://person.com#bob"));

            foreach (var t0 in g.GetByPredicateObject("http://schema.com#employer", "http://person.com#acme"))
            {
                foreach (var t1 in g.GetBySubjectPredicate(t0.Subject, "http://schema.com#name"))
                {
                    foreach (var t2 in g.GetBySubjectPredicate(t1.Object.Id, "http://schema.com#first"))
                    {
                        Console.WriteLine(t2.Object);
                    }
                }
            }
        }
Ejemplo n.º 10
0
 public Block(GraphObject obj1, GraphObject obj2)
     : base()
 {
     object1 = obj1;
     object2 = obj2;
     this.Width = this.Depth = 0.25;
 }
Ejemplo n.º 11
0
        private GraphObject vobject; //Ссылка на векторный объект, которому принадлежит данная точка

        //Конструктор создания
        public MyPoint(int x, int y, int id, GraphObject vobject)
        {
            this.x       = x;
            this.y       = y;
            this.id      = id;
            this.vobject = vobject;
        }
Ejemplo n.º 12
0
 public void AddComponent(GraphObject functionItem)
 {
     if (functionItem != null)
     {
         _compositeFunction.Add(functionItem);
     }
 }
Ejemplo n.º 13
0
 public RotationGripHandle(IHitTestObject parent, PointD2D relPos, MatrixD2D spanningHalfYRhombus)
 {
     _parent               = parent;
     _drawrPosition        = relPos;
     _fixrPosition         = new PointD2D(0.5, 0.5);
     _fixaPosition         = GraphObject.RelativeLocalToAbsoluteParentCoordinates(_fixrPosition);
     _spanningHalfYRhombus = spanningHalfYRhombus;
 }
Ejemplo n.º 14
0
        private ViewModel map(GraphObject domainModel)
        {
            var domain = (DomaineDIntervention)domainModel;

            return(new DomaineDInterventionViewModel {
                Description = domain.Description, GraphId = domain.GraphKey
            });
        }
Ejemplo n.º 15
0
 public EditionObject SupprimerNoeud(GraphObject objetsupprime, string viewModelProprieteNom, GraphObject noeudModifie)
 {
     return(CreateEditionObject(
                viewModelProprieteNom: viewModelProprieteNom,
                graphModelProprieteNom: viewModelProprieteNom,
                objetSupprimeId: objetsupprime.GraphKey,
                noeudModifie: noeudModifie));
 }
Ejemplo n.º 16
0
        private void Edge_Selected(object sender)
        {
            Edge e = (Edge)sender;

            weightTextbox.Enabled = true;
            weightTextbox.Text    = e.Weight.ToString();
            currentObj            = e;
        }
Ejemplo n.º 17
0
 public T GetExtension <T>(GraphObject graphObject, T previous) where T : class
 {
     if (typeof(T) == typeof(IGraphNavigateToItem))
     {
         return(new GraphNodeNavigator() as T);
     }
     return(null);
 }
        static void Main(string[] args)
        {
            string      filePath    = @"D:\IronMan - Copy.obj";
            Parser      parser      = new Parser();
            GraphObject graphObject = parser.ParseFile(filePath);

            int i = 1;
        }
Ejemplo n.º 19
0
 public string Description(GraphObject graphObject, string graphCommandDefinitionIdentifier)
 {
     return(GetStringPropertyForGraphObject(
                graphObject,
                graphCommandDefinitionIdentifier,
                RoslynGraphProperties.Description,
                RoslynGraphProperties.DescriptionWithContainingSymbol));
 }
Ejemplo n.º 20
0
 public string Label(GraphObject graphObject, string graphCommandDefinitionIdentifier)
 {
     return(GetStringPropertyForGraphObject(
                graphObject,
                graphCommandDefinitionIdentifier,
                RoslynGraphProperties.FormattedLabelWithoutContainingSymbol,
                RoslynGraphProperties.FormattedLabelWithContainingSymbol));
 }
Ejemplo n.º 21
0
 public string Description(GraphObject graphObject, string graphCommandDefinitionIdentifier)
 {
     return GetStringPropertyForGraphObject(
         graphObject,
         graphCommandDefinitionIdentifier,
         RoslynGraphProperties.Description,
         RoslynGraphProperties.DescriptionWithContainingSymbol);
 }
Ejemplo n.º 22
0
 public string Label(GraphObject graphObject, string graphCommandDefinitionIdentifier)
 {
     return GetStringPropertyForGraphObject(
         graphObject,
         graphCommandDefinitionIdentifier,
         RoslynGraphProperties.FormattedLabelWithoutContainingSymbol,
         RoslynGraphProperties.FormattedLabelWithContainingSymbol);
 }
Ejemplo n.º 23
0
        public void NavigateTo(GraphObject graphObject)
        {
            if (graphObject is GraphNode graphNode)
            {
                var sourceLocation = graphNode.GetValue <SourceLocation>(CodeNodeProperties.SourceLocation);
                if (sourceLocation.FileName == null)
                {
                    return;
                }

                var projectId = graphNode.GetValue <ProjectId>(RoslynGraphProperties.ContextProjectId);
                var symbolId  = graphNode.GetValue <SymbolKey?>(RoslynGraphProperties.SymbolId);

                if (projectId != null)
                {
                    var solution = _workspace.CurrentSolution;
                    var project  = solution.GetProject(projectId);

                    if (project == null)
                    {
                        return;
                    }

                    var document = project.Documents.FirstOrDefault(
                        d => string.Equals(
                            d.FilePath,
                            sourceLocation.FileName.LocalPath,
                            StringComparison.OrdinalIgnoreCase));

                    if (document == null)
                    {
                        return;
                    }

                    if (IsForeground())
                    {
                        // If we are already on the UI thread, invoke NavigateOnForegroundThread
                        // directly to preserve any existing NewDocumentStateScope.
                        NavigateOnForegroundThread(sourceLocation, symbolId, project, document);
                    }
                    else
                    {
                        // Navigation must be performed on the UI thread. If we are invoked from a
                        // background thread then the current NewDocumentStateScope is unrelated to
                        // this navigation and it is safe to continue on the UI thread
                        // asynchronously.
                        Task.Factory.SafeStartNewFromAsync(
                            async() =>
                        {
                            await ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync();
                            NavigateOnForegroundThread(sourceLocation, symbolId, project, document);
                        },
                            CancellationToken.None,
                            TaskScheduler.Default);
                    }
                }
            }
        }
Ejemplo n.º 24
0
        public override void UpdateGraphObject(GraphObject graphObject, ViewModel viewModel)
        {
            var perfectionnementObject    = (Formation)graphObject;
            var perfectionnementViewModel = (PerfectionnementViewModel)viewModel;

            perfectionnementObject.AnAcquisition = perfectionnementViewModel.Annee;
            perfectionnementObject.Description   = perfectionnementViewModel.Description;
            formationGraphRepository.Update(perfectionnementObject);
        }
Ejemplo n.º 25
0
        public override void UpdateGraphObject(GraphObject graphObject, ViewModel viewModel)
        {
            var conferenceObject    = (Formation)graphObject;
            var conferenceViewModel = (ConferenceViewModel)viewModel;

            conferenceObject.AnAcquisition = conferenceViewModel.Annee;
            conferenceObject.Description   = conferenceViewModel.Description;
            formationGraphRepository.Update(conferenceObject);
        }
Ejemplo n.º 26
0
        public override void UpdateGraphObject(GraphObject graphObject, ViewModel viewModel)
        {
            var certificationObject    = (Formation)graphObject;
            var certificationViewModel = (CertificationViewModel)viewModel;

            certificationObject.AnAcquisition = certificationViewModel.Annee;
            certificationObject.Description   = certificationViewModel.Description;
            formationGraphRepository.Update(certificationObject);
        }
Ejemplo n.º 27
0
        private void Edge_Selected(object sender)
        {
            Edge e = (Edge)sender;

            textBoxWeight.Enabled = true;
            textBoxWeight.Focus();
            textBoxWeight.Text = e.Weight.ToString();
            currentObj         = e;
        }
Ejemplo n.º 28
0
 public IMDBGraphObject(GraphObject graphObject)
 {
     this.Description = graphObject.Description;
     this.Image       = graphObject.Image;
     this.Site        = graphObject.Site;
     this.Title       = graphObject.Title;
     this.Type        = graphObject.Type;
     this.Url         = graphObject.Url;
 }
Ejemplo n.º 29
0
        public void ChangerPropriete(GraphObject noeudModifie, Expression <Func <object> > viewModelPropriete, Expression <Func <object> > graphModelPropriete, string graphModelProprieteNom = null)
        {
            string viewModelProprieteNom;
            var    viewModelProprieteMemberEx = viewModelPropriete.Body as MemberExpression;

            if (viewModelProprieteMemberEx != null)
            {
                viewModelProprieteNom = viewModelProprieteMemberEx.Member.Name;
            }
            else
            {
                dynamic viewModelProprieteEx = viewModelPropriete.Body;
                viewModelProprieteNom = viewModelProprieteEx.Operand.Member.Name;
            }

            var nouvelleValeur = viewModelPropriete.Compile()()?.ToString();

            if (graphModelProprieteNom == null)
            {
                var graphModelProprieteMemberEx = graphModelPropriete.Body as MemberExpression;
                if (graphModelProprieteMemberEx != null)
                {
                    graphModelProprieteNom = graphModelProprieteMemberEx.Member.Name;
                }
                else
                {
                    dynamic graphModelProprieteEx = graphModelPropriete.Body;
                    graphModelProprieteNom = graphModelProprieteEx.Operand.Member.Name;
                }
            }

            var actuelleValeur = graphModelPropriete.Compile()()?.ToString();

            EditionObject edition = FindEditionObjectOfType(viewModelProprieteNom: viewModelProprieteNom, graphnoeud: noeudModifie, type: EditionObjectType.ChangementPropriete, editionEtat: EditionObjectEtat.Modifie);

            if (edition != null)
            {
                if (nouvelleValeur == actuelleValeur)
                {
                    Delete(edition);
                }
                else
                {
                    edition.ProprieteValeur = nouvelleValeur;
                    Update(edition);
                }
            }
            else
            {
                edition = CreateEditionObject(
                    viewModelProprieteNom: viewModelProprieteNom,
                    graphModelProprieteNom: graphModelProprieteNom,
                    proprieteValuer: nouvelleValeur,
                    noeudModifie: noeudModifie);
            }
        }
Ejemplo n.º 30
0
        public void NavigateTo(GraphObject graphObject)
        {
            var graphNode = graphObject as GraphNode;

            if (graphNode != null)
            {
                var sourceLocation = graphNode.GetValue<SourceLocation>(CodeNodeProperties.SourceLocation);
                if (sourceLocation.FileName == null)
                {
                    return;
                }

                var projectId = graphNode.GetValue<ProjectId>(RoslynGraphProperties.ContextProjectId);
                var symbolId = graphNode.GetValue<SymbolKey?>(RoslynGraphProperties.SymbolId);

                if (projectId != null)
                {
                    var solution = _workspace.CurrentSolution;
                    var project = solution.GetProject(projectId);

                    if (project == null)
                    {
                        return;
                    }

                    var document = project.Documents.FirstOrDefault(
                        d => string.Equals(
                            d.FilePath,
                            sourceLocation.FileName.LocalPath,
                            StringComparison.OrdinalIgnoreCase));

                    if (document == null)
                    {
                        return;
                    }

                    if (IsForeground())
                    {
                        // If we are already on the UI thread, invoke NavigateOnForegroundThread
                        // directly to preserve any existing NewDocumentStateScope.
                        NavigateOnForegroundThread(sourceLocation, symbolId, project, document);
                    }
                    else
                    {
                        // Navigation must be performed on the UI thread. If we are invoked from a
                        // background thread then the current NewDocumentStateScope is unrelated to
                        // this navigation and it is safe to continue on the UI thread 
                        // asynchronously.
                        Task.Factory.SafeStartNew(
                            () => NavigateOnForegroundThread(sourceLocation, symbolId, project, document),
                            CancellationToken.None,
                            ForegroundTaskScheduler);
                    }
                }
            }
        }
Ejemplo n.º 31
0
            public PathNodeGripHandle(IHitTestObject parent, PointD2D relPos, PointD2D gripCenter, double gripRadius)
            {
                _parent        = parent;
                _drawrPosition = relPos;
                _fixrPosition  = new PointD2D(relPos.X == 0 ? 1 : 0, relPos.Y == 0 ? 1 : 0);
                _fixaPosition  = GraphObject.RelativeToAbsolutePosition(_fixrPosition, true);

                _gripCenter = gripCenter;
                _gripRadius = gripRadius;
            }
Ejemplo n.º 32
0
        private ViewModel mapTechnologie(GraphObject technologieModel)
        {
            var tech = (Technologie)technologieModel;

            return(new TechnologieViewModel
            {
                Description = tech.Nom,
                GraphId = tech.GraphKey,
            });
        }
Ejemplo n.º 33
0
        private ViewModel mapTache(GraphObject tacheModel)
        {
            var tache = (Tache)tacheModel;

            return(new TacheViewModel
            {
                Description = tache.Description,
                GraphId = tache.GraphKey,
            });
        }
Ejemplo n.º 34
0
        public bool HasEdge(Attributes.Edge edge, GraphObject from, GraphObject to)
        {
            bool   hasEdge;
            string findEdgeQuery           = $"g.E().hasLabel('{edge.EdgeName}').has('_vertexId', '{ from.GraphKey }').has('_sink', '{to.GraphKey}').count()";
            FeedResponse <dynamic> reponse = ExecuteCommandQueryDynamic(findEdgeQuery);

            hasEdge = Convert.ToInt32(reponse.First()) > 0;

            return(hasEdge);
        }
        public void NavigateTo(GraphObject graphObject)
        {
            GraphNode node = (GraphNode)graphObject;
            Uri file = node.Id.GetNestedValueByName<Uri>(CodeGraphNodeIdName.File);
            ParseItem item = node.Id.GetNestedValueByName<ParseItem>(CssGraphSchema.CssParseItem);

            if (file != null && item != null)
            {
                EditorExtensionsPackage.DTE.ItemOperations.OpenFile(file.LocalPath);
                IWpfTextView view = ProjectHelpers.GetCurentTextView();
                SnapshotSpan span = new SnapshotSpan(view.TextBuffer.CurrentSnapshot, item.Start, 0);
                view.Caret.MoveTo(span.Start);
                view.ViewScroller.EnsureSpanVisible(span);
            }
        }
Ejemplo n.º 36
0
        private string GetStringPropertyForGraphObject(GraphObject graphObject, string graphCommandDefinitionIdentifier, GraphProperty propertyWithoutContainingSymbol, GraphProperty propertyWithContainingSymbol)
        {
            var graphNode = graphObject as GraphNode;

            if (graphNode != null)
            {
                if (graphCommandDefinitionIdentifier != GraphCommandDefinition.Contains.Id)
                {
                    return graphNode.GetValue<string>(propertyWithContainingSymbol);
                }
                else
                {
                    return graphNode.GetValue<string>(propertyWithoutContainingSymbol);
                }
            }

            return null;
        }
        public void NavigateTo(GraphObject graphObject)
        {
            var graphNode = graphObject as GraphNode;

            if (graphNode != null)
            {
                var sourceLocation = graphNode.GetValue<SourceLocation>(CodeNodeProperties.SourceLocation);
                if (sourceLocation.FileName == null)
                {
                    return;
                }

                var projectId = graphNode.GetValue<ProjectId>(RoslynGraphProperties.ContextProjectId);
                var symbolId = graphNode.GetValue<SymbolKey>(RoslynGraphProperties.SymbolId);

                if (projectId != null)
                {
                    var solution = _workspace.CurrentSolution;
                    var project = solution.GetProject(projectId);

                    if (project == null)
                    {
                        return;
                    }

                    var document = project.Documents.FirstOrDefault(
                        d => string.Equals(
                            d.FilePath,
                            sourceLocation.FileName.LocalPath,
                            StringComparison.OrdinalIgnoreCase));

                    if (document == null)
                    {
                        return;
                    }

                    Task.Factory.SafeStartNew(
                        () => NavigateOnForegroundThread(sourceLocation, symbolId, project, document),
                        CancellationToken.None,
                        ForegroundTaskScheduler);
                }
            }
        }
Ejemplo n.º 38
0
        public int GetRank(GraphObject graphObject)
        {
            var graphNode = graphObject as GraphNode;

            if (graphNode != null)
            {
                var sourceLocation = graphNode.GetValue<SourceLocation>(CodeNodeProperties.SourceLocation);
                var projectId = graphNode.GetValue<ProjectId>(RoslynGraphProperties.ContextProjectId);

                if (sourceLocation.IsValid && projectId != null)
                {
                    return GraphNavigateToItemRanks.OwnItem;
                }
            }

            return GraphNavigateToItemRanks.CanNavigateToItem;
        }
Ejemplo n.º 39
0
        void RenderGraphObject(GraphObject graphObject, RenderFlags renderFlags)
        {
            // visibility check
            if (!graphObject.Visible)
            {
                return;
            }

            // render-flag check
            if (!renderFlags.HasFlag(RenderFlags.Ceilings) && graphObject.HasRenderFlag(GraphObjectRenderFlags.Ceiling))
            {
                return;
            }
            if (!renderFlags.HasFlag(RenderFlags.FourthWalls) && graphObject.HasRenderFlag(GraphObjectRenderFlags.FourthWall))
            {
                return;
            }

            // matrix transformations
            GL.PushMatrix();
            TransformMatrix(graphObject.Position, graphObject.Rotation, graphObject.Scale);

            // bounding box
            if (renderFlags.HasFlag(RenderFlags.BoundingBox))
            {
                GL.Disable(EnableCap.Lighting);
                GL.Disable(EnableCap.Texture2D);
                GL.Color3(Color.Yellow);
                GLUtility.WireCube(graphObject.BoundingBox * GlobalScaleReciprocal);
                GL.Color3(Color.White);
                GL.Enable(EnableCap.Texture2D);
                GL.Enable(EnableCap.Lighting);
            }

            if (graphObject.HasRenderFlag(GraphObjectRenderFlags.FullBright))
            {
                GL.Disable(EnableCap.Lighting);
            }

            // Render parts.
            foreach (var part in graphObject)
            {
                if (shaders[part.ShaderIndex].Tint.A > 0 && ((shaders[part.ShaderIndex].Tint.A == Color.Opaque && renderFlags.HasFlag(RenderFlags.Opaque)) || (shaders[part.ShaderIndex].Tint.A < Color.Opaque && renderFlags.HasFlag(RenderFlags.Translucent))))
                {
                    RenderPart(part, renderFlags);
                }
            }

            GL.Enable(EnableCap.Lighting);

            // Render children.
            for (int childIndex = graphObject.ChildIndex; childIndex >= 0; childIndex = graphObjects[childIndex].NextIndex)
            {
                RenderGraphObject(graphObjects[childIndex], renderFlags);
            }

            GL.PopMatrix();
        }
Ejemplo n.º 40
0
        GraphObject GetGraphObject(int index)
        {
            const int itemSize = 0x8C;

            binaryReader.Goto(GraphOffset + itemSize * index);
            binaryReader.PositionAnchor = GraphOffset;
            GraphObject graphObject = new GraphObject(binaryReader);
            binaryReader.ResetAnchor();
            binaryReader.Back();

            return graphObject;
        }
Ejemplo n.º 41
0
 public void NavigateTo(GraphObject graphObject)
 {
     // TODO: implement navigating to the packages.config maybe?
 }
Ejemplo n.º 42
0
 public int GetRank(GraphObject graphObject)
 {
     return GraphNavigateToItemRanks.CanNavigateToItem;
 }
Ejemplo n.º 43
0
 //DrawObjects
 public GraphObject AddGraph(GraphObject go)
 {
     this._graphObjects.Add(go);
     return go;
 }
Ejemplo n.º 44
0
 /// <summary>
 /// Открепляет объект от крепежа.
 /// </summary>
 /// <param name="obj"></param>
 public void Unlock(GraphObject obj)
 {
     this.FixtureObjects.Remove(obj);
 }
Ejemplo n.º 45
0
        /// <summary>
        /// Закрепляет новый объект на крепеже.
        /// </summary>
        /// <param name="obj">Закрепляемый объект.</param>
        /// <param name="lockPoint">Точка крепления.</param>
        public void Lock(GraphObject obj, Point3d lockPoint = null, PositionType type = PositionType.Relative)
        {
            if (lockPoint == null)
                lockPoint = obj.Position;

            if (type == PositionType.Relative)
                obj.Position = this.Position + lockPoint;

            this.FixtureObjects.Add(obj);
        }
 public int GetRank(GraphObject graphObject)
 {
     return 0;
 }