Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : :
21 : : #include <svx/sdr/contact/viewobjectcontactofe3d.hxx>
22 : : #include <svx/sdr/contact/viewcontactofe3d.hxx>
23 : : #include <basegfx/color/bcolor.hxx>
24 : : #include <drawinglayer/primitive3d/modifiedcolorprimitive3d.hxx>
25 : : #include <svx/sdr/contact/viewobjectcontactofe3dscene.hxx>
26 : : #include <drawinglayer/primitive2d/embedded3dprimitive2d.hxx>
27 : : #include <svx/sdr/contact/viewcontactofe3dscene.hxx>
28 : :
29 : : //////////////////////////////////////////////////////////////////////////////
30 : : // predeclarations
31 : :
32 : : //////////////////////////////////////////////////////////////////////////////
33 : :
34 : : namespace sdr
35 : : {
36 : : namespace contact
37 : : {
38 : 537 : ViewObjectContactOfE3d::ViewObjectContactOfE3d(ObjectContact& rObjectContact, ViewContact& rViewContact)
39 [ + - ]: 537 : : ViewObjectContactOfSdrObj(rObjectContact, rViewContact)
40 : : {
41 : 537 : }
42 : :
43 [ + - ]: 537 : ViewObjectContactOfE3d::~ViewObjectContactOfE3d()
44 : : {
45 [ - + ]: 1074 : }
46 : :
47 : 0 : drawinglayer::primitive3d::Primitive3DSequence ViewObjectContactOfE3d::createPrimitive3DSequence(const DisplayInfo& rDisplayInfo) const
48 : : {
49 : : // get the view-independent Primitive from the viewContact
50 [ # # ]: 0 : const ViewContactOfE3d& rViewContactOfE3d(dynamic_cast< const ViewContactOfE3d& >(GetViewContact()));
51 : 0 : drawinglayer::primitive3d::Primitive3DSequence xRetval(rViewContactOfE3d.getViewIndependentPrimitive3DSequence());
52 : :
53 : : // handle ghosted
54 [ # # ][ # # ]: 0 : if(isPrimitiveGhosted(rDisplayInfo))
55 : : {
56 : 0 : const ::basegfx::BColor aRGBWhite(1.0, 1.0, 1.0);
57 : 0 : const ::basegfx::BColorModifier aBColorModifier(aRGBWhite, 0.5, ::basegfx::BCOLORMODIFYMODE_INTERPOLATE);
58 [ # # ][ # # ]: 0 : const drawinglayer::primitive3d::Primitive3DReference xReference(new drawinglayer::primitive3d::ModifiedColorPrimitive3D(xRetval, aBColorModifier));
[ # # ]
59 [ # # ][ # # ]: 0 : xRetval = drawinglayer::primitive3d::Primitive3DSequence(&xReference, 1);
[ # # ][ # # ]
60 : : }
61 : :
62 : 0 : return xRetval;
63 : : }
64 : :
65 : 0 : drawinglayer::primitive2d::Primitive2DSequence ViewObjectContactOfE3d::createPrimitive2DSequence(const DisplayInfo& rDisplayInfo) const
66 : : {
67 : 0 : const ViewContactOfE3d& rViewContact = static_cast< const ViewContactOfE3d& >(GetViewContact());
68 : :
69 : : // get 3d primitive vector, isPrimitiveVisible() is done in 3d creator
70 [ # # ]: 0 : return rViewContact.impCreateWithGivenPrimitive3DSequence(getPrimitive3DSequence(rDisplayInfo));
71 : : }
72 : :
73 : 0 : drawinglayer::primitive3d::Primitive3DSequence ViewObjectContactOfE3d::getPrimitive3DSequence(const DisplayInfo& rDisplayInfo) const
74 : : {
75 [ # # ]: 0 : drawinglayer::primitive3d::Primitive3DSequence xNewPrimitive3DSeq(createPrimitive3DSequence(rDisplayInfo));
76 : :
77 : : // local up-to-date checks. New list different from local one?
78 [ # # ][ # # ]: 0 : if(!drawinglayer::primitive3d::arePrimitive3DSequencesEqual(mxPrimitive3DSequence, xNewPrimitive3DSeq))
79 : : {
80 : : // has changed, copy content
81 [ # # ]: 0 : const_cast< ViewObjectContactOfE3d* >(this)->mxPrimitive3DSequence = xNewPrimitive3DSeq;
82 : : }
83 : :
84 : : // return current Primitive2DSequence
85 [ # # ][ # # ]: 0 : return mxPrimitive3DSequence;
86 : : }
87 : : } // end of namespace contact
88 : : } // end of namespace sdr
89 : :
90 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|