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

#include <stdio.h>
#include "Structure.h"
#include "Building.h"
#include "Fence.h"

vtStructInstance::vtStructInstance() : vtStructure()
{
	SetType(ST_INSTANCE);

	m_p.Set(0, 0);
	m_fRotation = 0.0f;
	m_fScale = 1.0f;
	m_fElevationOffset = 0.0f;
	m_fOriginalElevation = -1E9;
}

void vtStructInstance::WriteXML_Old(FILE *fp, bool bDegrees)
{
	const char *coord_format;
	if (bDegrees)
		coord_format = "%lg";
	else
		coord_format = "%.2lf";

	fprintf(fp, "\t<structure type=\"instance\">\n");

	// first write the placement
	fprintf(fp, "\t\t<placement location=\"");
	fprintf(fp, coord_format, m_p.x);
	fprintf(fp, " ");
	fprintf(fp, coord_format, m_p.y);
	fprintf(fp, "\"");
	if (m_fRotation != 0.0f)
	{
		fprintf(fp, " rotation=\"%f\"", m_fRotation);
	}
	fprintf(fp, " />\n");
/*
	// now write any and all tags
	int i;
	for (i = 0; i < NumTags(); i++)
	{
		vtTag *tag = GetTag(i);
		fprintf(fp, "\t\t<%s>%s</%s>\n", (const char *)tag->name,
			(const char *)tag->value, (const char *)tag->name);
	}
*/
	fprintf(fp, "\t</structure>\n");
}

void vtStructInstance::WriteXML(FILE *fp, bool bDegrees)
{
	const char *coord_format;
	if (bDegrees)
		coord_format = "%lg";
	else
		coord_format = "%.2lf";

	fprintf(fp, "\t<Imported>\n");

	// first write the placement
	fprintf(fp, "\t\t<Location>\n");
	fprintf(fp, "\t\t\t<gml:coordinates>");
	fprintf(fp, coord_format, m_p.x);
	fprintf(fp, ",");
	fprintf(fp, coord_format, m_p.y);
	fprintf(fp, "</gml:coordinates>\n");
	fprintf(fp, "\t\t</Location>\n");

	if (m_fRotation != 0.0f)
	{
		fprintf(fp, "\t\t<Rotation Radians=\"%f\"/>\n", m_fRotation);
	}
	WriteTags(fp);
	fprintf(fp, "\t</Imported>\n");
}

bool vtStructInstance::GetExtents(DRECT &rect) const
{
	// we have no way (yet) of knowing the extents of an external
	// reference, so just give a placeholder of a single point.
	rect.SetRect(m_p.x, m_p.y, m_p.x, m_p.y);
	return true;
}

void vtStructInstance::Offset(const DPoint2 &delta)
{
	m_p += delta;
}


bool vtStructInstance::IsContainedBy(const DRECT &rect) const
{
	return rect.ContainsPoint(m_p);
}


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

vtStructure::vtStructure()
{
	m_type = ST_NONE;
#ifdef VIAVTDATA
	m_bIsVIAContributor = false;
	m_bIsVIATarget = false;
#endif
}

vtStructure::~vtStructure()
{
	m_type = ST_NONE;
}

void vtStructure::WriteTags(FILE *fp)
{
	// now write all extra tags (attributes) for this structure
	int i;
	for (i = 0; i < NumTags(); i++)
	{
		vtTag *tag = GetTag(i);
		fprintf(fp, "\t\t<%s>%s</%s>\n", (const char *)tag->name,
			(const char *)tag->value, (const char *)tag->name);
	}
}
<commit_msg>fixed init of vtStructure members<commit_after>//
// Structure.cpp
//
// Copyright (c) 2001 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//

#include <stdio.h>
#include "Structure.h"
#include "Building.h"
#include "Fence.h"

vtStructInstance::vtStructInstance() : vtStructure()
{
	SetType(ST_INSTANCE);

	m_p.Set(0, 0);
	m_fRotation = 0.0f;
	m_fScale = 1.0f;
}

void vtStructInstance::WriteXML_Old(FILE *fp, bool bDegrees)
{
	const char *coord_format;
	if (bDegrees)
		coord_format = "%lg";
	else
		coord_format = "%.2lf";

	fprintf(fp, "\t<structure type=\"instance\">\n");

	// first write the placement
	fprintf(fp, "\t\t<placement location=\"");
	fprintf(fp, coord_format, m_p.x);
	fprintf(fp, " ");
	fprintf(fp, coord_format, m_p.y);
	fprintf(fp, "\"");
	if (m_fRotation != 0.0f)
	{
		fprintf(fp, " rotation=\"%f\"", m_fRotation);
	}
	fprintf(fp, " />\n");
/*
	// now write any and all tags
	int i;
	for (i = 0; i < NumTags(); i++)
	{
		vtTag *tag = GetTag(i);
		fprintf(fp, "\t\t<%s>%s</%s>\n", (const char *)tag->name,
			(const char *)tag->value, (const char *)tag->name);
	}
*/
	fprintf(fp, "\t</structure>\n");
}

void vtStructInstance::WriteXML(FILE *fp, bool bDegrees)
{
	const char *coord_format;
	if (bDegrees)
		coord_format = "%lg";
	else
		coord_format = "%.2lf";

	fprintf(fp, "\t<Imported>\n");

	// first write the placement
	fprintf(fp, "\t\t<Location>\n");
	fprintf(fp, "\t\t\t<gml:coordinates>");
	fprintf(fp, coord_format, m_p.x);
	fprintf(fp, ",");
	fprintf(fp, coord_format, m_p.y);
	fprintf(fp, "</gml:coordinates>\n");
	fprintf(fp, "\t\t</Location>\n");

	if (m_fRotation != 0.0f)
	{
		fprintf(fp, "\t\t<Rotation Radians=\"%f\"/>\n", m_fRotation);
	}
	WriteTags(fp);
	fprintf(fp, "\t</Imported>\n");
}

bool vtStructInstance::GetExtents(DRECT &rect) const
{
	// we have no way (yet) of knowing the extents of an external
	// reference, so just give a placeholder of a single point.
	rect.SetRect(m_p.x, m_p.y, m_p.x, m_p.y);
	return true;
}

void vtStructInstance::Offset(const DPoint2 &delta)
{
	m_p += delta;
}


bool vtStructInstance::IsContainedBy(const DRECT &rect) const
{
	return rect.ContainsPoint(m_p);
}


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

vtStructure::vtStructure()
{
	m_type = ST_NONE;
	m_fElevationOffset = 0.0f;
	m_fOriginalElevation = -1E9;
#ifdef VIAVTDATA
	m_bIsVIAContributor = false;
	m_bIsVIATarget = false;
#endif
}

vtStructure::~vtStructure()
{
	m_type = ST_NONE;
}

void vtStructure::WriteTags(FILE *fp)
{
	// now write all extra tags (attributes) for this structure
	int i;
	for (i = 0; i < NumTags(); i++)
	{
		vtTag *tag = GetTag(i);
		fprintf(fp, "\t\t<%s>%s</%s>\n", (const char *)tag->name,
			(const char *)tag->value, (const char *)tag->name);
	}
}

{'fraction_non_alphanumeric': 0.21278901734104047, 'fraction_numerical': 0.008309248554913294, 'mean_word_length': 3.6490344248530646, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 45, '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': '7034716', 'n_tokens_mistral': 2295, 'n_tokens_neox': 2250, 'n_words': 496}