Exemplo n.º 1
0
void ProjectionDlg::AskStatePlane()
{
	// Pop up choices for State Plane
	StatePlaneDlg dialog(this, 201, _("Select State Plane"));
	if (dialog.ShowModal() != wxID_OK)
		return;

	StatePlaneInfo *plane_info = GetStatePlaneTable();
	int selection = dialog.m_iStatePlane;
	int bNAD83 = !dialog.m_bNAD27;
	int usgs_code = plane_info[selection].usgs_code;

	OGRErr result;
	if (dialog.m_bFeet)
		result = m_proj.SetStatePlane(usgs_code, bNAD83, SRS_UL_FOOT, GetMetersPerUnit(LU_FEET_INT));
	else if (dialog.m_bFeetUS)
		result = m_proj.SetStatePlane(usgs_code, bNAD83, SRS_UL_US_FOOT, GetMetersPerUnit(LU_FEET_US));
	else
		result = m_proj.SetStatePlane(usgs_code, bNAD83);

	if (result == OGRERR_FAILURE)
	{
		wxMessageBox(_("Couldn't set state plane projection.  Perhaps the\n EPSG tables could not be located.  Check that your\n GEOTIFF_CSV environment variable is set."));
	}
	else
	{
		SetUIFromProjection();
	}
}
Exemplo n.º 2
0
double MgdFeatureInfoRenderer::GetDrawingScale()
{
    // compute drawing scale
    // drawing scale is map scale converted to [mapping units] / [pixels]
    double metersPerPixel = METERS_PER_INCH / m_dpi;
    return m_mapScale * metersPerPixel / GetMetersPerUnit();
}
Exemplo n.º 3
0
void ProjectionDlg::OnHorizUnits( wxCommandEvent &event )
{
	TransferDataFromWindow();

	m_iUnits = m_pHorizCtrl->GetSelection();

	LinearUnits iUnits = (LinearUnits) (long int) m_pHorizCtrl->GetClientData(m_iUnits);

	if (iUnits == LU_METERS)
	{
		m_proj.SetLinearUnits(SRS_UL_METER, 1.0);
	}
	if (iUnits == LU_FEET_INT)
	{
		m_proj.SetLinearUnits(SRS_UL_FOOT, GetMetersPerUnit(iUnits));
	}
	if (iUnits == LU_FEET_US)
	{
		m_proj.SetLinearUnits(SRS_UL_US_FOOT, GetMetersPerUnit(iUnits));
	}

	TransferDataToWindow();
	UpdateControlStatus();
}
Exemplo n.º 4
0
/**
 * Determine the approximate spacing, in meters, between each grid cell, in the X
 * direction.  The result is placed in the m_fSpacing member for use in shading.
 */
void vtElevLayer::DetermineMeterSpacing()
{
	vtProjection &proj = m_pGrid->GetProjection();
	if (proj.IsGeographic())
	{
		const DRECT &area = m_pGrid->GetEarthExtents();

		const double fToMeters = EstimateDegreesToMeters((area.bottom + area.top)/2);
		m_fSpacing = (float) (area.Width()) * fToMeters / (m_pGrid->NumColumns() - 1);
	}
	else
	{
		// Linear units-based projections are much simpler
		const DPoint2 &spacing = m_pGrid->GetSpacing();
		m_fSpacing = spacing.x * GetMetersPerUnit(proj.GetUnits());
	}
}