1 /***************************************************************************
2 * This file is part of Tecorrec. *
3 * Copyright 2008 James Hogan <james@albanarts.com> *
5 * Tecorrec is free software: you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation, either version 2 of the License, or *
8 * (at your option) any later version. *
10 * Tecorrec is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with Tecorrec. If not, write to the Free Software Foundation, *
17 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
21 * @file tcCustomSunDirection.cpp
22 * @brief Dataset with raytraced shadow classification using a custom sun direction.
25 #include "tcCustomSunDirection.h"
26 #include "tcSrtmModel.h"
27 #include "tcChannelManager.h"
28 #include "tcLambertianShading.h"
29 #include "tcRaytracedShadowMap.h"
34 * Constructors + destructor
37 /// Primary constructor.
38 tcCustomSunDirection::tcCustomSunDirection(tcSrtmModel
* dem
, const tcGeo
& sunDirection
, const tcGeo
& sunReference
, bool shading
)
39 : tcShadowClassifyingData()
41 setName(QObject::tr("Custom sun direction"));
42 //setTexToGeo(landsatDatasets[0]->texToGeo());
43 setSunDirection(sunDirection
, sunReference
);
46 tcGeoImageData* refImagery = landsatDatasets[0];
47 tcChannel* reference = refImagery->channelManager()->channel(0);
49 tcLambertianShading* upshading = new tcLambertianShading(reference, dem, this, maths::Vector<3,float>(0.0f, 0.0f, 1.0f));
50 channelManager()->addChannel(upshading);
53 double pixelRes
= 30.0/6378.137e3
;
54 tcRaytracedShadowMap
* raytrace
= new tcRaytracedShadowMap(tcGeo(pixelRes
, pixelRes
), dem
, this);
55 channelManager()->addChannel(raytrace
);
56 setShadowClassification(raytrace
);
58 tcLambertianShading
* diffuse
= new tcLambertianShading(channelManager()->channel(0), dem
, this);
59 channelManager()->addChannel(diffuse
);
64 tcCustomSunDirection::~tcCustomSunDirection()