layered_figure.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Software License Agreement (BSD License) *
3  * Copyright (C) 2016 by Horatiu George Todoran <todorangrg@gmail.com> *
4  * *
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions *
7  * are met: *
8  * *
9  * 1. Redistributions of source code must retain the above copyright *
10  * notice, this list of conditions and the following disclaimer. *
11  * 2. Redistributions in binary form must reproduce the above copyright *
12  * notice, this list of conditions and the following disclaimer in *
13  * the documentation and/or other materials provided with the *
14  * distribution. *
15  * 3. Neither the name of the copyright holder nor the names of its *
16  * contributors may be used to endorse or promote products derived *
17  * from this software without specific prior written permission. *
18  * *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
23  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER *
27  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY *
29  * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
30  * POSSIBILITY OF SUCH DAMAGE. *
31  ***************************************************************************/
32 
34 
35 #include <opencv2/core/core.hpp>
36 #include <opencv2/core/core_c.h>
37 #include <opencv2/opencv.hpp>
38 
39 using namespace cv;
40 using namespace std;
41 using namespace tuw;
42 
43 
44 
45 LayeredFigure::LayeredFigure( const std::string &_title ) : Figure(_title), view_idx_(0), sizeLayers_(0) {
46  namedWindow( title(), cv::WINDOW_AUTOSIZE | cv::WINDOW_GUI_EXPANDED);
47  std::string namet1 = "MapLayer";
48 
49 // cv::setMouseCallback ( title(), GlobalInterface::onMouseMap, this );
50  createTrackbar( namet1, title(), &view_idx_, layeredMaps.sizeLayers()+1, LayeredFigure::callbackTrkbar1 );
51 }
52 
53 void LayeredFigure::callbackTrkbar1( int flags, void* param ) {
54 
55 }
56 
57 void LayeredFigure::init ( int width_pixel, int height_pixel,
58  double min_y, double max_y,
59  double min_x, double max_x, double rotation,
60  double grid_scale_x, double grid_scale_y, const string& background_image ) {
61  tuw::Figure::init ( width_pixel, height_pixel, min_y, max_y, min_x, max_x, rotation, grid_scale_x, grid_scale_y, background_image );
62  layeredMaps.initLayers(width_pixel, height_pixel, min_y, max_y, min_x, max_x, rotation);
63 
66  destroyWindow(title());
67  namedWindow( title(), cv::WINDOW_AUTOSIZE | cv::WINDOW_GUI_EXPANDED);
68  std::string namet1 = "MapLayer";
69  createTrackbar( namet1, title(), &view_idx_, sizeLayers_, LayeredFigure::callbackTrkbar1 );
70  }
71 }
72 
74  if(view_idx_>0) {
75 // setView(layeredMaps.mapLayer(view_idx_-1));
77  }
78  imshow ( title(), view() );
79 // switch (view_idx_) {
80 // case (0): imshow ( title(), view() ); break;
81 // default : imshow ( title(), layeredMaps.mapLayer(view_idx_-1) ); break;
82 // }
83  waitKey( 10 );
84  clear();
85 }
86 
tuw::LayeredMaps::initLayers
void initLayers(int width_pixel, int height_pixel, double min_x, double max_x, double min_y, double max_y, double rotation=0)
Definition: layered_maps.cpp:47
tuw::Figure::white
static const cv::Scalar white
Definition: figure.h:200
tuw::WorldScopedMaps::min_y
double min_y() const
Definition: world_scoped_maps.cpp:93
tuw::WorldScopedMaps::min_x
double min_x() const
Definition: world_scoped_maps.cpp:84
tuw::WorldScopedMaps::max_x
double max_x() const
Definition: world_scoped_maps.cpp:81
layered_figure.h
tuw::LayeredFigure::layeredMaps
LayeredMaps layeredMaps
Definition: layered_figure.h:96
tuw::Figure
Definition: figure.h:16
tuw::Figure::clear
void clear()
Definition: figure.cpp:138
tuw::Figure::title
const std::string title() const
Definition: figure.cpp:156
tuw::Figure::appendToView
void appendToView(const cv::Mat &_mat, const cv::Scalar &_colMin, const cv::Scalar &_colMax, u_int8_t _truncateLayerVal=0)
Definition: figure.cpp:180
tuw::LayeredFigure::sizeLayers_
size_t sizeLayers_
Definition: layered_figure.h:100
tuw::LayeredFigure::outputPlot
void outputPlot()
Definition: layered_figure.cpp:73
tuw
Definition: command.h:8
tuw::Figure::view
const cv::Mat & view() const
Definition: figure.cpp:55
tuw::WorldScopedMaps::max_y
double max_y() const
Definition: world_scoped_maps.cpp:90
tuw::Figure::black
static const cv::Scalar black
Definition: figure.h:199
tuw::LayeredMaps::mapLayer
cv::Mat & mapLayer(const size_t &_layer)
Definition: layered_maps.cpp:74
tuw::LayeredFigure::view_idx_
int view_idx_
Definition: layered_figure.h:99
std
tuw::LayeredMaps::sizeLayers
size_t sizeLayers() const
Definition: layered_maps.cpp:54
cv
Definition: point2d.h:208
tuw::LayeredFigure::callbackTrkbar1
static void callbackTrkbar1(int flags, void *param)
Definition: layered_figure.cpp:53
tuw::WorldScopedMaps::init
void init()
initializes the transformation matrices
Definition: world_scoped_maps.cpp:24


tuw_geometry
Author(s): Markus Bader
autogenerated on Sun Feb 26 2023 03:25:40