GeodesicGridDrawer.cpp   GeodesicGridDrawer.cpp 
skipping to change at line 22 skipping to change at line 22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#include <QString> #include <QString>
#include "StelCore.hpp" #include "StelCore.hpp"
#include "GeodesicGridDrawer.hpp" #include "StelGeodesicGridDrawer.hpp"
#include "Projector.hpp" #include "StelProjector.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelFontMgr.hpp" #include "StelFontMgr.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
GeodesicGridDrawer::GeodesicGridDrawer(int maxLevel) StelGeodesicGridDrawer::StelGeodesicGridDrawer(int maxLevel)
{ {
setObjectName("GeodesicGridDrawer"); setObjectName("StelGeodesicGridDrawer");
// geodesicGrid = new GeodesicGrid(maxLevel);
// geodesic_search_result = new GeodesicSearchResult(*geodesicGrid);
font = &StelApp::getInstance().getFontManager().getStandardFont(Stel App::getInstance().getLocaleMgr().getAppLanguage()); font = &StelApp::getInstance().getFontManager().getStandardFont(Stel App::getInstance().getLocaleMgr().getAppLanguage());
} }
GeodesicGridDrawer::~GeodesicGridDrawer() StelGeodesicGridDrawer::~StelGeodesicGridDrawer()
{ {
// delete geodesic_search_result;
// delete geodesicGrid;
} }
void GeodesicGridDrawer::init() void StelGeodesicGridDrawer::init()
{ {
} }
double GeodesicGridDrawer::draw(StelCore* core, int maxSearchLevel) double StelGeodesicGridDrawer::draw(StelCore* core, int maxSearchLevel)
{ {
Projector* prj = core->getProjection(); const StelProjectorP prj = core->getProjection();
GeodesicGrid* geodesicGrid = core->getGeodesicGrid(); StelPainter sPainter(prj);
StelGeodesicGrid* geodesicGrid = core->getGeodesicGrid();
const GeodesicSearchResult* geodesic_search_result = geodesicGrid->s earch(prj->unprojectViewport(), maxSearchLevel); const GeodesicSearchResult* geodesic_search_result = geodesicGrid->s earch(prj->unprojectViewport(), maxSearchLevel);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transpa rency mode glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal transpa rency mode
prj->setCurrentFrame(Projector::FrameJ2000); // set 2D coordinate core->setCurrentFrame(StelCore::FrameJ2000); // set 2D coordinate
glColor4f(0.2,0.3,0.2,1); glColor4f(0.2,0.3,0.2,1);
int lev = (int)(7./pow(prj->getFov(), 0.4))+2; int lev = (int)(7./pow(prj->getFov(), 0.4))+2;
if (lev>geodesicGrid->getMaxLevel()) if (lev>geodesicGrid->getMaxLevel())
lev = geodesicGrid->getMaxLevel(); lev = geodesicGrid->getMaxLevel();
lev = maxSearchLevel; lev = maxSearchLevel;
// Vec3d e0, e1, e2, e3;
Vec3d win1, win2; Vec3d win1, win2;
// prj->unproject_j2000(0,0,e0);
// prj->unproject_j2000(prj->getViewportWidth(),0,e1);
// prj->unproject_j2000(prj->getViewportWidth(),prj->getViewportHeight(
),e2);
// prj->unproject_j2000(0,prj->getViewportHeight(),e3);
// geodesic_search_result->search(e0, e3, e2, e1, lev);
int index; int index;
Vec3d v0, v1, v2; Vec3d v0, v1, v2;
{ {
GeodesicSearchInsideIterator it1(*geodesic_search_result, le v); GeodesicSearchInsideIterator it1(*geodesic_search_result, le v);
while((index = it1.next()) >= 0) while((index = it1.next()) >= 0)
{ {
Vec3d center; Vec3d center(0);
geodesicGrid->getTriangleCorners(lev, index, v0, v1, v2); geodesicGrid->getTriangleCorners(lev, index, v0, v1, v2);
prj->project(v0, win1); prj->project(v0, win1);
prj->project(v1, win2); prj->project(v1, win2);
center += win1; center += win1;
glBegin (GL_LINES); glBegin (GL_LINES);
glVertex2f(win1[0],win1[1]); glVertex2f(win1[0],win1[1]);
glVertex2f(win2[0],win2[1]); glVertex2f(win2[0],win2[1]);
glEnd(); glEnd();
prj->project(v1, win1); prj->project(v1, win1);
prj->project(v2, win2); prj->project(v2, win2);
skipping to change at line 111 skipping to change at line 102
QString str = QString("%1 (%2)").arg(index) QString str = QString("%1 (%2)").arg(index)
.arg(geodesicGrid->g etPartnerTriangle(lev, index)); .arg(geodesicGrid->g etPartnerTriangle(lev, index));
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
prj->drawText(font,center[0]-6, center[1]+6, str); prj->drawText(font,center[0]-6, center[1]+6, str);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
} }
} }
GeodesicSearchBorderIterator it1(*geodesic_search_result, lev); GeodesicSearchBorderIterator it1(*geodesic_search_result, lev);
while((index = it1.next()) >= 0) while((index = it1.next()) >= 0)
{ {
Vec3d center; Vec3d center(0);
geodesicGrid->getTriangleCorners(lev, index, v0, v1, v2); geodesicGrid->getTriangleCorners(lev, index, v0, v1, v2);
prj->project(v0, win1); prj->project(v0, win1);
prj->project(v1, win2); prj->project(v1, win2);
center += win1; center += win1;
glBegin (GL_LINES); glBegin (GL_LINES);
glVertex2f(win1[0],win1[1]); glVertex2f(win1[0],win1[1]);
glVertex2f(win2[0],win2[1]); glVertex2f(win2[0],win2[1]);
glEnd(); glEnd();
prj->project(v1, win1); prj->project(v1, win1);
prj->project(v2, win2); prj->project(v2, win2);
 End of changes. 13 change blocks. 
23 lines changed or deleted 13 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/