Cumulia Illustrator Rendering Engine v1.0.0
A Rendering engine for industrial CAD/CAE model and optimized for greatest performance
 
Loading...
Searching...
No Matches
legend.h
1//##################################################################################################
2//
3// Copyright (c) 2024 Beijing Qiongqi Tech Co.,Ltd. All rights reserved.
4
5// This source code is confidential and proprietary to Beijing Qiongqi Tech Co.,Ltd(The Holder).
6// Any unauthorized use, copying, modification, or distribution of the code is strictly prohibited.
7// Any user shall obtain authorizaition from the Holder before modifying the source code. And the user shall not
8// sublicense, sell, distribute, or transfer the source code, whether in original or modified form, to any third party
9// without the prior written consent of the Holder.
10
11// This copyright notice and permission grant shall be included in all copies or substantial portions of the source code.
12
13// Author Cumulia Illustrator
14// Date 2024-05-01
15// Version V1.0.0
16//##################################################################################################
17
18#pragma once
19
20#include <cilcore.h>
21
22#include <string>
23#include <vector>
24
25namespace cil
26{
27 class LegendNode : public Node
28 {
29 public:
30 static int Width;
31 static int Height;
32 static int Padding;
33 static int BarWidth;
34 static int TitleHeight;
35 std::shared_ptr<Image2D> image;
36 std::string title;
37 float minimum = 0;
38 float maximum = 1;
39 float levels = 4;
40
41 public:
42 LegendNode(const std::shared_ptr<Renderer>& renderer, const std::shared_ptr<Vector2i>& backgroundSize, const std::shared_ptr<Vector2i>& windowSize, const std::string& fontFile);
43 virtual ~LegendNode();
44
45 void update();
46
47 private:
48 std::shared_ptr<Renderer> m_renderer;
49 std::shared_ptr<Vector2i> m_backgroundSize;
50 std::shared_ptr<Vector2i> m_windowSize;
51 std::string m_fontFile;
52 };
53
54 class Legend : public Pass
55 {
56 public:
57 Legend(const std::shared_ptr<Renderer>& renderer, const std::shared_ptr<Vector2i>& backgroundSize, const std::shared_ptr<Vector2i>& windowSize, const std::string& fontFile);
58 virtual ~Legend();
59
60 std::shared_ptr<LegendNode> add(const std::string& title, const std::shared_ptr<Image2D>& image);
61 void remove(const std::shared_ptr<LegendNode>& node);
62 void clear();
63 void resize();
64 std::shared_ptr<LegendNode> hit(int x, int y);
65
66 private:
67 void updateCamera();
68
69 private:
70 std::shared_ptr<Renderer> m_renderer;
71 std::shared_ptr<Vector2i> m_backgroundSize;
72 std::shared_ptr<Vector2i> m_windowSize;
73 std::string m_fontFile;
74 };
75
76 std::shared_ptr<Legend> _legend(const std::shared_ptr<Renderer>& renderer, const std::shared_ptr<Vector2i>& backgroundSize, const std::shared_ptr<Vector2i>& windowSize, const std::string& fontFile);
77}
Definition legend.h:28
static int Height
Definition legend.h:31
virtual ~LegendNode()
static int Width
Definition legend.h:30
float maximum
Definition legend.h:38
static int BarWidth
Definition legend.h:33
static int TitleHeight
Definition legend.h:34
LegendNode(const std::shared_ptr< Renderer > &renderer, const std::shared_ptr< Vector2i > &backgroundSize, const std::shared_ptr< Vector2i > &windowSize, const std::string &fontFile)
static int Padding
Definition legend.h:32
float levels
Definition legend.h:39
std::shared_ptr< Image2D > image
Definition legend.h:35
float minimum
Definition legend.h:37
std::string title
Definition legend.h:36
Definition legend.h:55
void clear()
virtual ~Legend()
std::shared_ptr< LegendNode > add(const std::string &title, const std::shared_ptr< Image2D > &image)
void remove(const std::shared_ptr< LegendNode > &node)
std::shared_ptr< LegendNode > hit(int x, int y)
Legend(const std::shared_ptr< Renderer > &renderer, const std::shared_ptr< Vector2i > &backgroundSize, const std::shared_ptr< Vector2i > &windowSize, const std::string &fontFile)
void resize()
The Node class represents a node in a scene graph. A scene graph is a hierarchicaldata stucture used ...
Definition node.h:35
The Pass class represents a rendering pass within a graphics pipeline.
Definition pass.h:34
std::shared_ptr< Node > node
This member holds a shared pointer to a Node object which represents the rendering objects of the cur...
Definition pass.h:40
Definition decal.h:23
std::shared_ptr< Legend > _legend(const std::shared_ptr< Renderer > &renderer, const std::shared_ptr< Vector2i > &backgroundSize, const std::shared_ptr< Vector2i > &windowSize, const std::string &fontFile)