OpenStructure
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
build-2.6
stage
include
ost
gfx
surface.hh
Go to the documentation of this file.
1
//------------------------------------------------------------------------------
2
// This file is part of the OpenStructure project <www.openstructure.org>
3
//
4
// Copyright (C) 2008-2020 by the OpenStructure authors
5
//
6
// This library is free software; you can redistribute it and/or modify it under
7
// the terms of the GNU Lesser General Public License as published by the Free
8
// Software Foundation; either version 3.0 of the License, or (at your option)
9
// any later version.
10
// This library is distributed in the hope that it will be useful, but WITHOUT
11
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13
// details.
14
//
15
// You should have received a copy of the GNU Lesser General Public License
16
// along with this library; if not, write to the Free Software Foundation, Inc.,
17
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
//------------------------------------------------------------------------------
19
#ifndef OST_GFX_SURFACE_HH
20
#define OST_GFX_SURFACE_HH
21
22
/*
23
graphical representation of all kinds of surfaces
24
25
Author: Ansgar Philippsen
26
*/
27
28
#include <boost/shared_ptr.hpp>
29
30
#include <
ost/config.hh
>
31
#include <
ost/mol/surface.hh
>
32
#include "
gfx_object.hh
"
33
#include "
vertex_array.hh
"
34
35
#include <
ost/gfx/color_ops/uniform_color_op.hh
>
36
#include <
ost/gfx/color_ops/basic_gradient_color_op.hh
>
37
#include <
ost/gfx/color_ops/gradient_level_color_op.hh
>
38
#include <
ost/gfx/color_ops/entity_view_color_op.hh
>
39
#include <
ost/gfx/color_ops/map_handle_color_op.hh
>
40
41
namespace
ost {
namespace
gfx {
42
43
class
Surface
;
44
typedef
boost::shared_ptr<Surface>
SurfaceP
;
45
46
class
DLLEXPORT_OST_GFX
Surface
:
public
GfxObj
{
47
typedef
std::map<mol::SurfaceVertexID, VertexID> VMap;
48
49
public
:
50
Surface
(
const
String
& name,
const
mol::SurfaceHandle
& sh);
51
52
virtual
void
OnRenderModeChange();
53
54
virtual
void
CustomRenderGL(
RenderPass
pass);
55
virtual
void
CustomRenderPov(
PovState
& pov);
56
virtual
geom::AlignedCuboid
GetBoundingBox(
bool
use_global=
false
)
const
;
57
58
mol::SurfaceHandle
GetHandle()
const
;
59
60
void
Rebuild();
61
void
Replace(
const
mol::SurfaceHandle
& sh);
62
64
void
SetColor(
const
Color
& col,
const
String
& selection=
String
(
""
));
65
66
// GfxObj property interface
67
virtual
void
ColorBy(
const
mol::EntityView
& ev,
68
const
String
& prop,
69
const
Gradient
& g,
float
minv,
float
maxv);
70
// GfxObj property interface
71
virtual
void
ColorBy(
const
img::MapHandle
& mh,
72
const
String
& prop,
73
const
Gradient
& g,
float
minv,
float
maxv);
74
75
// map property to color gradient from minv to maxv
76
void
ColorBy(
const
String
& prop,
77
const
Gradient
& gradient,
78
float
minv,
float
maxv,
79
mol::Prop::Level
hint=
mol::Prop::UNSPECIFIED
);
80
81
// convenience
82
void
ColorBy(
const
String
& prop,
83
const
Gradient
& gradient,
84
mol::Prop::Level
hint=
mol::Prop::UNSPECIFIED
);
85
86
// convenience
87
void
ColorBy(
const
String
& prop,
88
const
Color
& c1,
const
Color
& c2,
89
float
min,
float
max,
90
mol::Prop::Level
hint=
mol::Prop::UNSPECIFIED
);
91
92
// convenience
93
void
ColorBy(
const
String
& prop,
94
const
Color
& c1,
const
Color
& c2,
95
mol::Prop::Level
hint=
mol::Prop::UNSPECIFIED
);
96
97
98
void
Apply(
const
gfx::UniformColorOp
& op,
bool
store=
true
);
99
void
Apply(
const
gfx::BasicGradientColorOp
& op,
bool
store=
true
);
100
void
Apply(
const
gfx::GradientLevelColorOp
& op,
bool
store=
true
);
101
void
Apply(
const
gfx::EntityViewColorOp
& op,
bool
store=
true
);
102
void
Apply(
const
gfx::MapHandleColorOp
& op,
bool
store=
true
);
103
104
void
CleanColorOps();
105
void
ReapplyColorOps();
106
107
protected
:
108
virtual
void
CustomPreRenderGL(
bool
flag);
109
110
private
:
111
112
mol::SurfaceHandle
sh_;
113
VMap vmap_;
114
115
mutable
bool
recalc_bb_;
116
117
boost::ptr_vector<gfx::ColorOp> c_ops_;
118
};
119
120
}}
// ns
121
122
#endif
basic_gradient_color_op.hh
gradient_level_color_op.hh
ost::gfx::UniformColorOp
Definition:
uniform_color_op.hh:36
uniform_color_op.hh
String
std::string String
Definition:
base.hh:54
geom::AlignedCuboid
axis-aligned cuboid
Definition:
aligned_cuboid.hh:35
ost::gfx::BasicGradientColorOp
Definition:
basic_gradient_color_op.hh:36
ost::gfx::EntityViewColorOp
Definition:
entity_view_color_op.hh:37
vertex_array.hh
gfx_object.hh
ost::gfx::GfxObj
main class for all graphic objects
Definition:
gfx_object.hh:51
map_handle_color_op.hh
ost::gfx::PovState
Definition:
povray.hh:35
DLLEXPORT_OST_GFX
#define DLLEXPORT_OST_GFX
Definition:
module_config.hh:27
ost::gfx::Surface
Definition:
surface.hh:46
ost::gfx::MapHandleColorOp
Definition:
map_handle_color_op.hh:37
config.hh
ost::mol::SurfaceHandle
Definition:
surface_handle.hh:39
ost::gfx::GradientLevelColorOp
Definition:
gradient_level_color_op.hh:38
surface.hh
ost::mol::Prop::UNSPECIFIED
Definition:
property_id.hh:48
entity_view_color_op.hh
ost::gfx::SurfaceP
boost::shared_ptr< Surface > SurfaceP
Definition:
surface.hh:43
ost::mol::Prop::Level
Level
Definition:
property_id.hh:47
ost::img::ImageHandle
Manage shared instances of images.
Definition:
image_handle.hh:111
ost::mol::EntityView
definition of EntityView
Definition:
entity_view.hh:86
ost::gfx::RenderPass
RenderPass
Definition:
render_pass.hh:27
ost::gfx::Gradient
color gradient
Definition:
gradient.hh:59
ost::gfx::Color
Definition:
color.hh:52
Generated by
1.8.5