<commit_before>//
// BuilderView.cpp
//
// Copyright (c) 2001 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//

#include "wx/wxprec.h"

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

#include "vtdata/shapelib/shapefil.h"
#include "vtdata/ElevationGrid.h"

#include "BuilderView.h"
#include "Frame.h"
#include "MenuEnum.h"
#include "Helper.h"
#include "VTBuilder_wdr.h"
// Layers
#include "ElevLayer.h"
#include "RawLayer.h"
#include "RoadLayer.h"
#include "StructLayer.h"
#include "UtilityLayer.h"

#include "cpl_error.h"

////////////////////////////////////////////////////////////////

#define BOUNDADJUST 5

BEGIN_EVENT_TABLE(BuilderView, vtScaledView)
	EVT_LEFT_DOWN(BuilderView::OnLeftDown)	
	EVT_LEFT_UP(BuilderView::OnLeftUp)
	EVT_LEFT_DCLICK(BuilderView::OnLeftDoubleClick)
	EVT_MIDDLE_DOWN(BuilderView::OnMiddleDown)
	EVT_MIDDLE_UP(BuilderView::OnMiddleUp)
	EVT_RIGHT_DOWN(BuilderView::OnRightDown)
	EVT_RIGHT_UP(BuilderView::OnRightUp)
	EVT_MOTION(BuilderView::OnMouseMove)

	EVT_CHAR(BuilderView::OnChar)
END_EVENT_TABLE()

/////////////////////////////////////////////////////////////////

BuilderView::BuilderView(wxWindow* parent, wxWindowID id, const wxPoint& pos,
						 const wxSize& size, const wxString& name) :
	vtScaledView(parent, id, pos, size, name )
{
	m_bPanning = false;
	m_bBoxing = false;
	m_mode = LB_None;
	m_iDragSide = 0;
	m_bCrossSelect = false;
	m_bMouseMoved = false;
	m_bLMouseButton = m_bMMouseButton = m_bRMouseButton = false;
	m_bShowMap = true;
	m_bShowUTMBounds = false;
	m_bRubber = false;

	// road point editing
	m_pEditingRoad = NULL;
	m_iEditingPoint = -1;

	// Cursors are a little messy, since support is not even across platforms
#if __WXMSW__
	m_pCursorPan = new wxCursor("cursors/panhand.cur", wxBITMAP_TYPE_CUR);
//#elif __WXMOTIF__
//	m_pCursorPan = new wxCursor("cursors/panhand.xbm", wxBITMAP_TYPE_XBM);
#else
	// the predefined "hand" cursor isn't quite correct, since it is a image
	// of a hand with a pointing finger, not a closed, grasping hand.
	m_pCursorPan = new wxCursor(wxCURSOR_HAND);
#endif

	// Import world map SHP file
	WMPoly = NULL;
	WMPolyDraw = NULL;
	m_NoLines = NULL;
	ImportWorldMap();
}

BuilderView::~BuilderView()
{
	delete [] WMPoly;
	delete [] WMPolyDraw;
	delete [] m_NoLines;
}

////////////////////////////////////////////////////////////
// Operations

void BuilderView::OnDraw(wxDC& dc)  // overridden to draw this view
{
	MainFrame *pFrame = GetMainFrame();
	vtLayerPtr lp;
	int i, iLayers = pFrame->m_Layers.GetSize();

	// Draw the world map SHP file of country outline polys in latlon
	if (m_bShowMap)
		DrawWorldMap(&dc, this);

	// Draw the solid layers first
	for (i = 0; i < iLayers; i++)
	{
		lp = pFrame->m_Layers.GetAt(i);
		if (!lp->GetVisible())
			continue;
		if (lp->GetType() != LT_IMAGE && lp->GetType() != LT_ELEVATION)
			continue;
		if (lp->GetVisible())
			lp->DrawLayer(&dc, this);
	}
	// Then the poly/vector/point layers
	for (i = 0; i < iLayers; i++)
	{
		lp = pFrame->m_Layers.GetAt(i);
		if (!lp->GetVisible())
			continue;
		if (lp->GetType() == LT_IMAGE || lp->GetType() == LT_ELEVATION)
			continue;
		if (lp->GetVisible())
			lp->DrawLayer(&dc, this);
	}
	if (pFrame->GetActiveElevLayer())
		HighlightTerrain(&dc, pFrame->GetActiveElevLayer());

	if (m_bShowUTMBounds)
		DrawUTMBounds(&dc);

	DrawArea(&dc);
}

void BuilderView::GetMouseLocation(DPoint2 &p)
{
	p.x = ox(m_CurPoint.x);
	p.y = oy(m_CurPoint.y);
}

void BuilderView::SetMode(LBMode m)
{
	if (m_mode == LB_Dir && m != LB_Dir)
	{
		vtRoadLayer::SetShowDirection(false);
		Refresh();
	}

	m_mode = m;
	SetCorrectCursor();
<commit_msg>removed a couple unused lines<commit_after>//
// BuilderView.cpp
//
// Copyright (c) 2001 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//

#include "wx/wxprec.h"

#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif

#include "vtdata/shapelib/shapefil.h"
#include "vtdata/ElevationGrid.h"

#include "BuilderView.h"
#include "Frame.h"
#include "MenuEnum.h"
#include "Helper.h"
#include "VTBuilder_wdr.h"
// Layers
#include "ElevLayer.h"
#include "RawLayer.h"
#include "RoadLayer.h"
#include "StructLayer.h"
#include "UtilityLayer.h"

#include "cpl_error.h"

////////////////////////////////////////////////////////////////

#define BOUNDADJUST 5

BEGIN_EVENT_TABLE(BuilderView, vtScaledView)
	EVT_LEFT_DOWN(BuilderView::OnLeftDown)	
	EVT_LEFT_UP(BuilderView::OnLeftUp)
	EVT_LEFT_DCLICK(BuilderView::OnLeftDoubleClick)
	EVT_MIDDLE_DOWN(BuilderView::OnMiddleDown)
	EVT_MIDDLE_UP(BuilderView::OnMiddleUp)
	EVT_RIGHT_DOWN(BuilderView::OnRightDown)
	EVT_RIGHT_UP(BuilderView::OnRightUp)
	EVT_MOTION(BuilderView::OnMouseMove)

	EVT_CHAR(BuilderView::OnChar)
END_EVENT_TABLE()

/////////////////////////////////////////////////////////////////

BuilderView::BuilderView(wxWindow* parent, wxWindowID id, const wxPoint& pos,
						 const wxSize& size, const wxString& name) :
	vtScaledView(parent, id, pos, size, name )
{
	m_bPanning = false;
	m_bBoxing = false;
	m_mode = LB_None;
	m_iDragSide = 0;
	m_bCrossSelect = false;
	m_bMouseMoved = false;
	m_bLMouseButton = m_bMMouseButton = m_bRMouseButton = false;
	m_bShowMap = true;
	m_bShowUTMBounds = false;
	m_bRubber = false;

	// road point editing
	m_pEditingRoad = NULL;
	m_iEditingPoint = -1;

	// Cursors are a little messy, since support is not even across platforms
#if __WXMSW__
	m_pCursorPan = new wxCursor("cursors/panhand.cur", wxBITMAP_TYPE_CUR);
//#elif __WXMOTIF__
//	m_pCursorPan = new wxCursor("cursors/panhand.xbm", wxBITMAP_TYPE_XBM);
#else
	// the predefined "hand" cursor isn't quite correct, since it is a image
	// of a hand with a pointing finger, not a closed, grasping hand.
	m_pCursorPan = new wxCursor(wxCURSOR_HAND);
#endif

	// Import world map SHP file
	WMPoly = NULL;
	WMPolyDraw = NULL;
	m_NoLines = NULL;
	ImportWorldMap();
}

BuilderView::~BuilderView()
{
	delete [] WMPoly;
	delete [] WMPolyDraw;
	delete [] m_NoLines;
}

////////////////////////////////////////////////////////////
// Operations

void BuilderView::OnDraw(wxDC& dc)  // overridden to draw this view
{
	MainFrame *pFrame = GetMainFrame();
	vtLayerPtr lp;
	int i, iLayers = pFrame->m_Layers.GetSize();

	// Draw the world map SHP file of country outline polys in latlon
	if (m_bShowMap)
		DrawWorldMap(&dc, this);

	// Draw the solid layers first
	for (i = 0; i < iLayers; i++)
	{
		lp = pFrame->m_Layers.GetAt(i);
		if (lp->GetType() != LT_IMAGE && lp->GetType() != LT_ELEVATION)
			continue;
		if (lp->GetVisible())
			lp->DrawLayer(&dc, this);
	}
	// Then the poly/vector/point layers
	for (i = 0; i < iLayers; i++)
	{
		lp = pFrame->m_Layers.GetAt(i);
		if (lp->GetType() == LT_IMAGE || lp->GetType() == LT_ELEVATION)
			continue;
		if (lp->GetVisible())
			lp->DrawLayer(&dc, this);
	}
	if (pFrame->GetActiveElevLayer())
		HighlightTerrain(&dc, pFrame->GetActiveElevLayer());

	if (m_bShowUTMBounds)
		DrawUTMBounds(&dc);

	DrawArea(&dc);
}

void BuilderView::GetMouseLocation(DPoint2 &p)
{
	p.x = ox(m_CurPoint.x);
	p.y = oy(m_CurPoint.y);
}

void BuilderView::SetMode(LBMode m)
{
	if (m_mode == LB_Dir && m != LB_Dir)
	{
		vtRoadLayer::SetShowDirection(false);
		Refresh();
	}

	m_mode = m;
	SetCorrectCursor();

{'fraction_non_alphanumeric': 0.18156656518128977, 'fraction_numerical': 0.0027677830058123443, 'mean_word_length': 3.5944055944055946, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '805379', 'n_tokens_mistral': 2873, 'n_tokens_neox': 2703, 'n_words': 592}