Example #1
0
        // only find local links
        void EntityLinkDecorator::gatherLinksLocal(Vec4f::List& vList, RenderContext& context, Model::Entity& curEnt) {
            if (!context.filter().entityVisible(curEnt))
                return;

            Model::EntityList::const_iterator it, end;
            const Model::EntityList& targetList = curEnt.linkTargets();

            for (it = targetList.begin(), end = targetList.end(); it != end; ++it) {
                const Model::Entity& targetEnt = **it;

                if (!context.filter().entityVisible(targetEnt))
                    continue;

                addArrowVerts(vList, curEnt.center(), targetEnt.center());
            }

            const Model::EntityList& sourceList = curEnt.linkSources();

            for (it = sourceList.begin(), end = sourceList.end(); it != end; ++it) {
                const Model::Entity& sourceEnt = **it;

                if (!context.filter().entityVisible(sourceEnt))
                    continue;

                addArrowVerts(vList, sourceEnt.center(), curEnt.center());
            }
        }
Example #2
0
        // find links in a "context"
        void EntityLinkDecorator::gatherLinks(Vec4f::List& vListLocal, Vec4f::List& vListContext, RenderContext& context, Model::Entity& curEnt, Model::EntitySet& visitedEntities) {
            Model::EntitySet::iterator vIt = visitedEntities.lower_bound(&curEnt);

            if (*vIt == &curEnt)
                return;

            visitedEntities.insert(vIt, &curEnt);

            if (!context.filter().entityVisible(curEnt))
                return;

            Model::EntityList::const_iterator it, end;
            const Model::EntityList& targetList = curEnt.linkTargets();

            for (it = targetList.begin(), end = targetList.end(); it != end; ++it) {
                Model::Entity& targetEnt = **it;

                if (!context.filter().entityVisible(targetEnt))
                    continue;

                if (curEnt.selected() || targetEnt.selected())
                    addArrowVerts(vListLocal, curEnt.center(), targetEnt.center());
                else
                    addArrowVerts(vListContext, curEnt.center(), targetEnt.center());

                gatherLinks(vListLocal, vListContext, context, targetEnt, visitedEntities);
            }

            const Model::EntityList& sourceList = curEnt.linkSources();

            for (it = sourceList.begin(), end = sourceList.end(); it != end; ++it) {
                Model::Entity& sourceEnt = **it;

                if (!context.filter().entityVisible(sourceEnt))
                    continue;

                gatherLinks(vListLocal, vListContext, context, sourceEnt, visitedEntities);
            }
        }