GeodesicGridDrawer.cpp   GeodesicGridDrawer.cpp 
skipping to change at line 25 skipping to change at line 25
* 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 "StelGeodesicGridDrawer.hpp" #include "StelGeodesicGridDrawer.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelFontMgr.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
StelGeodesicGridDrawer::StelGeodesicGridDrawer(int maxLevel) StelGeodesicGridDrawer::StelGeodesicGridDrawer(int maxLevel)
{ {
setObjectName("StelGeodesicGridDrawer"); setObjectName("StelGeodesicGridDrawer");
font = &StelApp::getInstance().getFontManager().getStandardFont(Stel App::getInstance().getLocaleMgr().getAppLanguage()); font = &StelApp::getInstance().getFontManager().getStandardFont(Stel App::getInstance().getLocaleMgr().getAppLanguage());
} }
StelGeodesicGridDrawer::~StelGeodesicGridDrawer() StelGeodesicGridDrawer::~StelGeodesicGridDrawer()
{ {
skipping to change at line 54 skipping to change at line 53
const StelProjectorP prj = core->getProjection(); const StelProjectorP prj = core->getProjection();
StelPainter sPainter(prj); StelPainter sPainter(prj);
StelGeodesicGrid* geodesicGrid = core->getGeodesicGrid(); 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
core->setCurrentFrame(StelCore::FrameJ2000); // set 2D coordinate core->setCurrentFrame(StelCore::FrameJ2000); // set 2D coordinate
glColor4f(0.2,0.3,0.2,1); sPainter.setColor(0.2,0.3,0.2);
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 win1, win2; Vec3d win1, win2;
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(0); 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); sPainter.drawLine2d(win1[0],win1[1], win2[0],win2[1]
glVertex2f(win1[0],win1[1]); );
glVertex2f(win2[0],win2[1]);
glEnd();
prj->project(v1, win1); prj->project(v1, win1);
prj->project(v2, win2); prj->project(v2, win2);
glBegin (GL_LINES); sPainter.drawLine2d(win1[0],win1[1], win2[0],win2[1]
glVertex2f(win1[0],win1[1]); );
glVertex2f(win2[0],win2[1]);
glEnd();
center += win1; center += win1;
prj->project(v2, win1); prj->project(v2, win1);
prj->project(v0, win2); prj->project(v0, win2);
glBegin (GL_LINES); sPainter.drawLine2d(win1[0],win1[1], win2[0],win2[1]
glVertex2f(win1[0],win1[1]); );
glVertex2f(win2[0],win2[1]);
glEnd();
center += win1; center += win1;
center*=0.33333; center*=0.33333;
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(0); 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); sPainter.drawLine2d(win1[0],win1[1], win2[0],win2[1]);
glVertex2f(win1[0],win1[1]);
glVertex2f(win2[0],win2[1]);
glEnd();
prj->project(v1, win1); prj->project(v1, win1);
prj->project(v2, win2); prj->project(v2, win2);
glBegin (GL_LINES); sPainter.drawLine2d(win1[0],win1[1], win2[0],win2[1]);
glVertex2f(win1[0],win1[1]);
glVertex2f(win2[0],win2[1]);
glEnd();
center += win1; center += win1;
prj->project(v2, win1); prj->project(v2, win1);
prj->project(v0, win2); prj->project(v0, win2);
glBegin (GL_LINES); sPainter.drawLine2d(win1[0],win1[1], win2[0],win2[1]);
glVertex2f(win1[0],win1[1]);
glVertex2f(win2[0],win2[1]);
glEnd();
center += win1; center += win1;
center*=0.33333; center*=0.33333;
QString str = QString("%1 (%2)").arg(index) QString str = QString("%1 (%2)").arg(index)
.arg(geodesicGrid->getPartne rTriangle(lev, index)); .arg(geodesicGrid->getPartne rTriangle(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);
} }
return 0.; return 0.;
 End of changes. 8 change blocks. 
26 lines changed or deleted 10 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/