mirror of
https://github.com/mcneel/opennurbs.git
synced 2026-09-04 08:57:55 +08:00
Merge pull request #58 from mcneel/update-1686347679-8.x
Sync changes from upstream repository
This commit is contained in:
@@ -2529,22 +2529,20 @@ ON_Decal* ON_3dmObjectAttributes::AddDecal(void)
|
||||
return m_private->m_decals.AddDecal();
|
||||
}
|
||||
|
||||
bool ON_3dmObjectAttributes::DeleteDecal(ON_Decal& decal)
|
||||
bool ON_3dmObjectAttributes::RemoveDecal(ON_Decal& decal)
|
||||
{
|
||||
if (nullptr == m_private)
|
||||
m_private = new ON_3dmObjectAttributesPrivate(this);
|
||||
|
||||
return m_private->m_decals.DeleteDecal(decal);
|
||||
return m_private->m_decals.RemoveDecal(decal);
|
||||
}
|
||||
|
||||
void ON_3dmObjectAttributes::DeleteAllDecals(void)
|
||||
void ON_3dmObjectAttributes::RemoveAllDecals(void)
|
||||
{
|
||||
//if (nullptr == m_private)
|
||||
// m_private = new ON_3dmObjectAttributesPrivate(this);
|
||||
if (nullptr == m_private)
|
||||
m_private = new ON_3dmObjectAttributesPrivate(this);
|
||||
|
||||
// Delete all the user data? [JOHN-DECAL-FIX]
|
||||
// TODO:
|
||||
// return m_private->m_decals.DeleteAllDecals();
|
||||
return m_private->m_decals.RemoveAllDecals();
|
||||
}
|
||||
|
||||
// {1403A7E4-E7AD-4a01-A2AA-41DAE6BE7ECB}
|
||||
|
||||
@@ -44,7 +44,9 @@ public:
|
||||
True if successful.
|
||||
(xform is invertable or didn't need to be).
|
||||
*/
|
||||
ON_DEPRECATED_MSG("Prefer the version that takes a const ON_Geometry* - for object frame support.") bool Transform( const ON_Xform& xform );
|
||||
ON_DEPRECATED_MSG("Prefer the version that takes a const ON_Geometry* - for object frame support.")
|
||||
bool Transform( const ON_Xform& xform );
|
||||
|
||||
bool Transform(const ON_Geometry* pOriginalGeometry, const ON_Xform& xform);
|
||||
|
||||
// attributes of geometry and dimension table objects
|
||||
@@ -532,15 +534,15 @@ public:
|
||||
|
||||
/*
|
||||
Description:
|
||||
Delete a decal from this attributes object. Returns true if successful, else false.
|
||||
Remove a decal from this attributes object. Returns true if successful, else false.
|
||||
*/
|
||||
bool DeleteDecal(ON_Decal& decal);
|
||||
bool RemoveDecal(ON_Decal& decal);
|
||||
|
||||
/*
|
||||
Description:
|
||||
Delete all decals from this attributes object.
|
||||
Remove all decals from this attributes object.
|
||||
*/
|
||||
void DeleteAllDecals(void);
|
||||
void RemoveAllDecals(void);
|
||||
|
||||
// Mesh Modifiers.
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
#if !defined(OPENNURBS_3DM_SETTINGS_INC_)
|
||||
#define OPENNURBS_3DM_SETTINGS_INC_
|
||||
|
||||
#include "opennurbs_post_effects.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// units and tolerances
|
||||
|
||||
@@ -378,9 +378,6 @@ public:
|
||||
// The dimension of a arc curve can be 2 or 3.
|
||||
// (2 so ON_ArcCurve can be used as a trimming curve)
|
||||
int m_dim = 3;
|
||||
|
||||
// TODO ON_LineCurve::GetClosestPoint( ON_Curve&...) doesn't need an override.
|
||||
#pragma warning(suppress : 4266)
|
||||
};
|
||||
|
||||
|
||||
|
||||
+4
-2
@@ -1144,7 +1144,8 @@ public:
|
||||
CRhinoObject::MeshCount
|
||||
CRhinoObject::IsMeshable
|
||||
*/
|
||||
ON_DEPRECATED_MSG("Support for bDeleteMesh no longer supported") void DestroyMesh( ON::mesh_type mesh_type, bool bDeleteMesh);
|
||||
ON_DEPRECATED_MSG("Support for bDeleteMesh no longer supported")
|
||||
void DestroyMesh( ON::mesh_type mesh_type, bool bDeleteMesh);
|
||||
|
||||
/*
|
||||
Description:
|
||||
@@ -1827,7 +1828,8 @@ public:
|
||||
ON_BrepFace::Mesh
|
||||
ON_BrepFace::SetMesh
|
||||
*/
|
||||
ON_DEPRECATED_MSG("bDeleteMesh=false is no longer supported") void DestroyMesh( ON::mesh_type mesh_type, bool bDeleteMesh);
|
||||
ON_DEPRECATED_MSG("bDeleteMesh=false is no longer supported")
|
||||
void DestroyMesh( ON::mesh_type mesh_type, bool bDeleteMesh);
|
||||
|
||||
/*
|
||||
Description:
|
||||
|
||||
@@ -458,7 +458,6 @@ public:
|
||||
double, // curve_t
|
||||
double* // nurbs_t
|
||||
) const override;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
+66
-39
@@ -26,6 +26,11 @@
|
||||
|
||||
static ON_4dPoint UNSET_4D_POINT = ON_4dPoint(ON_UNSET_VALUE, ON_UNSET_VALUE, ON_UNSET_VALUE, ON_UNSET_VALUE);
|
||||
|
||||
ON__UINT32 ON_DecalCRCFromNode(const ON_XMLNode& node)
|
||||
{
|
||||
return ON_Decal::ComputeDecalCRC(0, node);
|
||||
}
|
||||
|
||||
class ON_Decal::CImpl : public ON_InternalXMLImpl
|
||||
{
|
||||
public:
|
||||
@@ -966,40 +971,92 @@ ON__UINT32 ON_Decal::ComputeDecalCRC(ON__UINT32 crc, const ON_XMLNode& node) //
|
||||
|
||||
ON_DecalCollection::~ON_DecalCollection()
|
||||
{
|
||||
DeleteAllDecals();
|
||||
ClearDecalArray();
|
||||
}
|
||||
|
||||
int ON_DecalCollection::FindDecalIndex(const ON_Decal& decal) const
|
||||
int ON_DecalCollection::FindDecalIndex(const ON_UUID& id) const
|
||||
{
|
||||
for (int i = 0; i < m_decals.Count(); i++)
|
||||
{
|
||||
if (decal.Id() == m_decals[i]->Id())
|
||||
if (m_decals[i]->Id() == id)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool ON_DecalCollection::DeleteDecal(ON_Decal& decal)
|
||||
ON_Decal* ON_DecalCollection::AddDecal(void)
|
||||
{
|
||||
// Ensure the array is populated before adding a new decal.
|
||||
GetDecalArray();
|
||||
|
||||
ON_Decal* decal = nullptr;
|
||||
|
||||
ON_XMLNode* decals_node = m_root_node.CreateNodeAtPath(ON_RDK_UD_ROOT ON_XML_SLASH ON_RDK_DECALS);
|
||||
if (nullptr != decals_node)
|
||||
{
|
||||
// Add an XML node for the new decal.
|
||||
auto* decal_node = new ON_XMLNode(ON_RDK_DECAL);
|
||||
decals_node->AttachChildNode(decal_node);
|
||||
|
||||
// Add the new decal. It stores a pointer to the new XML node. This is safe because
|
||||
// the decals have the same lifetime as the root node that owns the XML nodes.
|
||||
decal = new ON_Decal(*this, *decal_node);
|
||||
m_decals.Append(decal);
|
||||
|
||||
SetChanged();
|
||||
}
|
||||
|
||||
return decal;
|
||||
}
|
||||
|
||||
bool ON_DecalCollection::RemoveDecal(const ON_Decal& decal)
|
||||
{
|
||||
// Ensure the array is populated before deleting a decal.
|
||||
GetDecalArray();
|
||||
|
||||
const int index = FindDecalIndex(decal);
|
||||
// Remove the decal from the XML by finding the XML node with the same decal CRC
|
||||
// and then deleting that node.
|
||||
const ON__UINT32 decal_crc = decal.DecalCRC();
|
||||
|
||||
const wchar_t* path = ON_RDK_UD_ROOT ON_XML_SLASH ON_RDK_DECALS;
|
||||
ON_XMLNode* decals_node = m_root_node.GetNodeAtPath(path);
|
||||
if (nullptr != decals_node)
|
||||
{
|
||||
auto it = decals_node->GetChildIterator();
|
||||
ON_XMLNode* child_node = nullptr;
|
||||
while (nullptr != (child_node = it.GetNextChild()))
|
||||
{
|
||||
if (ON_DecalCRCFromNode(*child_node) == decal_crc)
|
||||
{
|
||||
child_node->Remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find the decal in the array.
|
||||
const int index = FindDecalIndex(decal.Id());
|
||||
if (index < 0)
|
||||
return false;
|
||||
|
||||
// Delete it.
|
||||
delete m_decals[index];
|
||||
m_decals.Remove(index);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ON_DecalCollection::DeleteAllDecals(void)
|
||||
void ON_DecalCollection::RemoveAllDecals(void)
|
||||
{
|
||||
m_root_node.Clear();
|
||||
m_root_node.CreateNodeAtPath(ON_RDK_UD_ROOT);
|
||||
|
||||
ClearDecalArray();
|
||||
}
|
||||
|
||||
void ON_DecalCollection::ClearDecalArray(void)
|
||||
{
|
||||
for (int i = 0; i < m_decals.Count(); i++)
|
||||
{
|
||||
delete m_decals[i];
|
||||
@@ -1007,14 +1064,14 @@ void ON_DecalCollection::DeleteAllDecals(void)
|
||||
|
||||
m_decals.Destroy();
|
||||
|
||||
m_populated = true;
|
||||
m_populated = false;
|
||||
|
||||
SetChanged();
|
||||
}
|
||||
|
||||
const ON_DecalCollection& ON_DecalCollection::operator = (const ON_DecalCollection& dc)
|
||||
{
|
||||
DeleteAllDecals();
|
||||
ClearDecalArray();
|
||||
|
||||
for (int i = 0; i < dc.m_decals.Count(); i++)
|
||||
{
|
||||
@@ -1065,43 +1122,13 @@ void ON_DecalCollection::Populate(void) const
|
||||
|
||||
void ON_DecalCollection::SetChanged(void)
|
||||
{
|
||||
ON_ASSERT(m_populated);
|
||||
|
||||
if (m_populated)
|
||||
m_changed = true;
|
||||
}
|
||||
|
||||
ON_Decal* ON_DecalCollection::AddDecal(void)
|
||||
{
|
||||
// Ensure the array is populated before adding a new decal.
|
||||
GetDecalArray();
|
||||
|
||||
ON_Decal* decal = nullptr;
|
||||
|
||||
ON_XMLNode* decals_node = m_root_node.CreateNodeAtPath(ON_RDK_UD_ROOT ON_XML_SLASH ON_RDK_DECALS);
|
||||
if (nullptr != decals_node)
|
||||
{
|
||||
// Add an XML node for the new decal.
|
||||
auto* decal_node = new ON_XMLNode(ON_RDK_DECAL);
|
||||
decals_node->AttachChildNode(decal_node);
|
||||
|
||||
// Add the new decal. It stores a pointer to the new XML node. This is safe because
|
||||
// the decals have the same lifetime as the root node that owns the XML nodes.
|
||||
decal = new ON_Decal(*this, *decal_node);
|
||||
m_decals.Append(decal);
|
||||
|
||||
SetChanged();
|
||||
}
|
||||
|
||||
return decal;
|
||||
m_changed = true;
|
||||
}
|
||||
|
||||
void ON_DecalCollection::UpdateUserData(unsigned int archive_3dm_version) const
|
||||
{
|
||||
if (m_changed)
|
||||
{
|
||||
ON_ASSERT(m_populated);
|
||||
|
||||
SetRDKObjectInformation(*m_attr, m_root_node.String(), archive_3dm_version);
|
||||
|
||||
m_changed = false;
|
||||
|
||||
@@ -174,4 +174,7 @@ private:
|
||||
CImpl* _impl;
|
||||
};
|
||||
|
||||
// For internal use only.
|
||||
ON__UINT32 ON_DECL ON_DecalCRCFromNode(const ON_XMLNode& node);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -109,8 +109,9 @@ public:
|
||||
const ON_DecalCollection& operator = (const ON_DecalCollection& dc);
|
||||
|
||||
ON_Decal* AddDecal(void);
|
||||
bool DeleteDecal(ON_Decal& decal);
|
||||
void DeleteAllDecals(void);
|
||||
bool RemoveDecal(const ON_Decal&);
|
||||
void RemoveAllDecals(void);
|
||||
void ClearDecalArray(void);
|
||||
const ON_SimpleArray<ON_Decal*>& GetDecalArray(void) const;
|
||||
|
||||
void SetChanged(void);
|
||||
@@ -119,7 +120,7 @@ public:
|
||||
|
||||
private:
|
||||
void Populate(void) const;
|
||||
int FindDecalIndex(const ON_Decal&) const;
|
||||
int FindDecalIndex(const ON_UUID& id) const;
|
||||
|
||||
private:
|
||||
ON_3dmObjectAttributes* m_attr;
|
||||
|
||||
+2
-2
@@ -656,7 +656,7 @@ public:
|
||||
bool DepthEnabled() const;
|
||||
void SetDepthEnabled(bool on);
|
||||
|
||||
// Default is true
|
||||
// Default is false
|
||||
bool ParticipationListsEnabled() const;
|
||||
void SetParticipationListsEnabled(bool on);
|
||||
|
||||
@@ -674,7 +674,7 @@ public:
|
||||
|
||||
private:
|
||||
bool m_depth_enabled = false;
|
||||
bool m_participation_lists_enabled = true;
|
||||
bool m_participation_lists_enabled = false;
|
||||
char m_reserved;
|
||||
|
||||
ON_ClippingPlaneDataStore m_data_store;
|
||||
|
||||
@@ -1133,7 +1133,7 @@ void ON_ClippingPlane::Default()
|
||||
m_plane_id = ON_nil_uuid;
|
||||
m_bEnabled = true;
|
||||
m_depth_enabled = false;
|
||||
m_participation_lists_enabled = true;
|
||||
m_participation_lists_enabled = false;
|
||||
DeleteClippingPlaneData(m_data_store);
|
||||
}
|
||||
|
||||
@@ -1541,7 +1541,7 @@ bool ON_ClippingPlane::Write( ON_BinaryArchive& file ) const
|
||||
rc = file.WriteBool(data->m_is_exclusion_list);
|
||||
if (!rc) break;
|
||||
}
|
||||
if (!m_participation_lists_enabled)
|
||||
if (m_participation_lists_enabled)
|
||||
{
|
||||
unsigned char c = ON_ClippingPlaneTypeCodes::ClipParticipationEnabled; // 13
|
||||
rc = file.WriteChar(c);
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
// first step in each build.
|
||||
//
|
||||
#define RMA_VERSION_YEAR 2023
|
||||
#define RMA_VERSION_MONTH 5
|
||||
#define RMA_VERSION_DATE 26
|
||||
#define RMA_VERSION_HOUR 13
|
||||
#define RMA_VERSION_MINUTE 4
|
||||
#define RMA_VERSION_MONTH 6
|
||||
#define RMA_VERSION_DATE 9
|
||||
#define RMA_VERSION_HOUR 14
|
||||
#define RMA_VERSION_MINUTE 36
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -35,8 +35,8 @@
|
||||
// 3 = build system release build
|
||||
#define RMA_VERSION_BRANCH 0
|
||||
|
||||
#define VERSION_WITH_COMMAS 8,0,23146,13040
|
||||
#define VERSION_WITH_PERIODS 8.0.23146.13040
|
||||
#define VERSION_WITH_COMMAS 8,0,23160,14360
|
||||
#define VERSION_WITH_PERIODS 8.0.23160.14360
|
||||
#define COPYRIGHT "Copyright (C) 1993-2023, Robert McNeel & Associates. All Rights Reserved."
|
||||
#define SPECIAL_BUILD_DESCRIPTION "Public OpenNURBS C++ 3dm file IO library."
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
#define RMA_VERSION_NUMBER_SR_STRING "SR0"
|
||||
#define RMA_VERSION_NUMBER_SR_WSTRING L"SR0"
|
||||
|
||||
#define RMA_VERSION_WITH_PERIODS_STRING "8.0.23146.13040"
|
||||
#define RMA_VERSION_WITH_PERIODS_WSTRING L"8.0.23146.13040"
|
||||
#define RMA_VERSION_WITH_PERIODS_STRING "8.0.23160.14360"
|
||||
#define RMA_VERSION_WITH_PERIODS_WSTRING L"8.0.23160.14360"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1177,7 +1177,7 @@ ON_XMLVariant ParamHelper(const ON_XMLParameters& p, const wchar_t* name)
|
||||
return value;
|
||||
}
|
||||
|
||||
ON_Material ON_RenderMaterial::SimulatedMaterial(void) const
|
||||
ON_Material ON_RenderMaterial::ToOnMaterial(void) const
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lg(m_impl->m_mutex);
|
||||
|
||||
@@ -1322,7 +1322,7 @@ const ON_RenderEnvironment& ON_RenderEnvironment::operator = (const ON_RenderEnv
|
||||
return *this;
|
||||
}
|
||||
|
||||
ON_Environment ON_RenderEnvironment::SimulatedEnvironment(void) const
|
||||
ON_Environment ON_RenderEnvironment::ToOnEnvironment(void) const
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lg(m_impl->m_mutex);
|
||||
|
||||
@@ -1387,7 +1387,7 @@ const ON_RenderTexture& ON_RenderTexture::operator = (const ON_RenderTexture& te
|
||||
return *this;
|
||||
}
|
||||
|
||||
ON_Texture ON_RenderTexture::SimulatedTexture(void) const
|
||||
ON_Texture ON_RenderTexture::ToOnTexture(void) const
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lg(m_impl->m_mutex);
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
virtual const ON_RenderContent& operator = (const ON_RenderContent&) override;
|
||||
virtual const ON_RenderMaterial& operator = (const ON_RenderMaterial&);
|
||||
|
||||
virtual ON_Material SimulatedMaterial(void) const;
|
||||
virtual ON_Material ToOnMaterial(void) const;
|
||||
};
|
||||
|
||||
class ON_CLASS ON_RenderEnvironment : public ON_RenderContent
|
||||
@@ -269,7 +269,7 @@ public:
|
||||
virtual const ON_RenderContent& operator = (const ON_RenderContent&) override;
|
||||
virtual const ON_RenderEnvironment& operator = (const ON_RenderEnvironment&);
|
||||
|
||||
virtual ON_Environment SimulatedEnvironment(void) const;
|
||||
virtual ON_Environment ToOnEnvironment(void) const;
|
||||
};
|
||||
|
||||
class ON_CLASS ON_RenderTexture : public ON_RenderContent
|
||||
@@ -284,7 +284,7 @@ public:
|
||||
virtual const ON_RenderContent& operator = (const ON_RenderContent&) override;
|
||||
virtual const ON_RenderTexture& operator = (const ON_RenderTexture&);
|
||||
|
||||
virtual ON_Texture SimulatedTexture(void) const;
|
||||
virtual ON_Texture ToOnTexture(void) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2925,9 +2925,19 @@ static ON_SubDFromMeshParameters Internal_ConvexCornersAndInteriorCreases()
|
||||
return cp;
|
||||
}
|
||||
|
||||
static ON_SubDFromMeshParameters Internal_ConvexAndConcaveCornersAndInteriorCreases()
|
||||
{
|
||||
ON_SubDFromMeshParameters cp;
|
||||
cp.SetInteriorCreaseOption(ON_SubDFromMeshParameters::InteriorCreaseOption::AtMeshDoubleEdge);
|
||||
cp.SetConvexCornerOption(ON_SubDFromMeshParameters::ConvexCornerOption::AtMeshCorner);
|
||||
cp.SetConcaveCornerOption(ON_SubDFromMeshParameters::ConcaveCornerOption::AtMeshCorner);
|
||||
return cp;
|
||||
}
|
||||
|
||||
const ON_SubDFromMeshParameters ON_SubDFromMeshParameters::Smooth;
|
||||
const ON_SubDFromMeshParameters ON_SubDFromMeshParameters::InteriorCreases = Internal_InteriorCreases();
|
||||
const ON_SubDFromMeshParameters ON_SubDFromMeshParameters::ConvexCornersAndInteriorCreases = Internal_ConvexCornersAndInteriorCreases();
|
||||
const ON_SubDFromMeshParameters ON_SubDFromMeshParameters::ConvexAndConcaveCornersAndInteriorCreases = Internal_ConvexAndConcaveCornersAndInteriorCreases();
|
||||
|
||||
const ON_SubDFromSurfaceParameters ON_SubDFromSurfaceParameters::Default;
|
||||
|
||||
|
||||
@@ -19045,8 +19045,6 @@ void ON_SubDVertexQuadSector::Internal_CopyFrom(const ON_SubDVertexQuadSector& s
|
||||
if ( ON_SubDVertexTag::Corner == center_vertex_tag)
|
||||
this->m_sector_coefficient = src.m_sector_coefficient;
|
||||
|
||||
const unsigned subdivision_level = src.SubdivisionLevel();
|
||||
|
||||
const unsigned vertex_count = src.SectorVertexCount();
|
||||
for (unsigned vi = 0; vi < vertex_count; ++vi)
|
||||
{
|
||||
|
||||
@@ -16946,10 +16946,18 @@ public:
|
||||
// Create an interior sub-D crease along all input mesh double edges.
|
||||
static const ON_SubDFromMeshParameters InteriorCreases;
|
||||
|
||||
// Create an interior sub-D crease along all input mesh double edges.
|
||||
// Look for convex corners at sub-D vertices with 2 edges
|
||||
// that have an included angle <= 90 degrees.
|
||||
static const ON_SubDFromMeshParameters ConvexCornersAndInteriorCreases;
|
||||
|
||||
// Create an interior sub-D crease along all input mesh double edges.
|
||||
// Look for convex corners at sub-D vertices with 2 edges
|
||||
// that have an included angle <= 90 degrees.
|
||||
// Look for concave corners at sub-D vertices with 3 edges
|
||||
// that have an included angle >= 270 degrees.
|
||||
static const ON_SubDFromMeshParameters ConvexAndConcaveCornersAndInteriorCreases;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Custom interior crease options
|
||||
|
||||
+110
-20
@@ -586,7 +586,7 @@ public:
|
||||
void SetIntensity(double d);
|
||||
double ShadowIntensity(void) const;
|
||||
void SetShadowIntensity(double d);
|
||||
bool IsUsingManualControl(void) const { return ManualControlAllowed() && ManualControlOn(); }
|
||||
bool IsUsingManualControl(void) const;
|
||||
|
||||
private:
|
||||
void UpdateAziAlt(void) const;
|
||||
@@ -600,6 +600,14 @@ public:
|
||||
ON_SunEngine::Accuracy _accuracy = ON_SunEngine::Accuracy::Minimum;
|
||||
};
|
||||
|
||||
bool ON_Sun::CImpl::IsUsingManualControl(void) const
|
||||
{
|
||||
// If manual control has been set on even if it's not 'allowed', consider it on anyway.
|
||||
// This makes it easier for clients that set manual control on without knowing they are supposed
|
||||
// to also allow it. I'm not even sure why it wouldn't be allowed nowadays. TODO: Ask Andy.
|
||||
return ManualControlOn();
|
||||
}
|
||||
|
||||
void ON_Sun::CImpl::GetEarthAnchorPlane(ON_3dVector& anchor_north, ON_Plane& plane) const
|
||||
{
|
||||
ON_3dVector anchor_east = _earth_anchor_point->ModelEast();
|
||||
@@ -677,16 +685,20 @@ void ON_Sun::CImpl::UpdateAziAlt(void) const
|
||||
}
|
||||
}
|
||||
|
||||
bool ON_Sun::CImpl::EnableAllowed(void)
|
||||
const { return GetParameter(XMLPath_Sun(), ON_RDK_SUN_ENABLE_ALLOWED, false); }
|
||||
bool ON_Sun::CImpl::EnableAllowed(void) const
|
||||
{
|
||||
return GetParameter(XMLPath_Sun(), ON_RDK_SUN_ENABLE_ALLOWED, false);
|
||||
}
|
||||
|
||||
void ON_Sun::CImpl::SetEnableAllowed(bool allowed)
|
||||
{
|
||||
SetParameter(XMLPath_Sun(), ON_RDK_SUN_ENABLE_ALLOWED, allowed);
|
||||
}
|
||||
|
||||
bool ON_Sun::CImpl::EnableOn(void)
|
||||
const { return GetParameter(XMLPath_Sun(), ON_RDK_SUN_ENABLE_ON, false); }
|
||||
bool ON_Sun::CImpl::EnableOn(void) const
|
||||
{
|
||||
return GetParameter(XMLPath_Sun(), ON_RDK_SUN_ENABLE_ON, false);
|
||||
}
|
||||
|
||||
void ON_Sun::CImpl::SetEnableOn(bool on)
|
||||
{
|
||||
@@ -694,15 +706,19 @@ void ON_Sun::CImpl::SetEnableOn(bool on)
|
||||
}
|
||||
|
||||
bool ON_Sun::CImpl::ManualControlAllowed(void) const
|
||||
{ return GetParameter(XMLPath_Sun(), ON_RDK_SUN_MANUAL_CONTROL_ALLOWED, false); }
|
||||
{
|
||||
return GetParameter(XMLPath_Sun(), ON_RDK_SUN_MANUAL_CONTROL_ALLOWED, false);
|
||||
}
|
||||
|
||||
void ON_Sun::CImpl::SetManualControlAllowed(bool allowed)
|
||||
{
|
||||
SetParameter(XMLPath_Sun(), ON_RDK_SUN_MANUAL_CONTROL_ALLOWED, allowed);
|
||||
}
|
||||
|
||||
bool ON_Sun::CImpl::ManualControlOn(void)
|
||||
const { return GetParameter(XMLPath_Sun(), ON_RDK_SUN_MANUAL_CONTROL_ON, false); }
|
||||
bool ON_Sun::CImpl::ManualControlOn(void) const
|
||||
{
|
||||
return GetParameter(XMLPath_Sun(), ON_RDK_SUN_MANUAL_CONTROL_ON, false);
|
||||
}
|
||||
|
||||
void ON_Sun::CImpl::SetManualControlOn(bool manual)
|
||||
{
|
||||
@@ -739,8 +755,10 @@ void ON_Sun::CImpl::SetAltitude(double altitude)
|
||||
SetParameter(XMLPath_Sun(), ON_RDK_SUN_ALTITUDE, altitude);
|
||||
}
|
||||
|
||||
double ON_Sun::CImpl::TimeZone(void)
|
||||
const { return GetParameter(XMLPath_Sun(), ON_RDK_SUN_OBSERVER_TIMEZONE, 0.0); }
|
||||
double ON_Sun::CImpl::TimeZone(void) const
|
||||
{
|
||||
return GetParameter(XMLPath_Sun(), ON_RDK_SUN_OBSERVER_TIMEZONE, 0.0);
|
||||
}
|
||||
|
||||
void ON_Sun::CImpl::SetTimeZone(double hours)
|
||||
{
|
||||
@@ -748,8 +766,10 @@ void ON_Sun::CImpl::SetTimeZone(double hours)
|
||||
_calc_dirty = true;
|
||||
}
|
||||
|
||||
bool ON_Sun::CImpl::DaylightSavingOn(void)
|
||||
const { return GetParameter(XMLPath_Sun(), ON_RDK_SUN_DAYLIGHT_SAVING_ON, false); }
|
||||
bool ON_Sun::CImpl::DaylightSavingOn(void) const
|
||||
{
|
||||
return GetParameter(XMLPath_Sun(), ON_RDK_SUN_DAYLIGHT_SAVING_ON, false);
|
||||
}
|
||||
|
||||
void ON_Sun::CImpl::SetDaylightSavingOn(bool on)
|
||||
{
|
||||
@@ -758,7 +778,9 @@ void ON_Sun::CImpl::SetDaylightSavingOn(bool on)
|
||||
}
|
||||
|
||||
int ON_Sun::CImpl::DaylightSavingMinutes(void) const
|
||||
{ return GetParameter(XMLPath_Sun(), ON_RDK_SUN_DAYLIGHT_SAVING_MINUTES, 0); }
|
||||
{
|
||||
return GetParameter(XMLPath_Sun(), ON_RDK_SUN_DAYLIGHT_SAVING_MINUTES, 0);
|
||||
}
|
||||
|
||||
void ON_Sun::CImpl::SetDaylightSavingMinutes(int minutes)
|
||||
{
|
||||
@@ -1001,7 +1023,7 @@ const ON_Sun& ON_Sun::operator = (const ON_Sun& sun)
|
||||
bool ON_Sun::operator == (const ON_Sun& sun) const
|
||||
{
|
||||
// When checking equality, we need to directly check the underlying storage. So we can't allow
|
||||
// virtual overrides to execute because they might hide the real values we want to copy.
|
||||
// virtual overrides to execute because they might hide the real values we want to check.
|
||||
|
||||
if (ON_Sun::EnableAllowed() != sun.ON_Sun::EnableAllowed()) return false;
|
||||
if (ON_Sun::EnableOn() != sun.ON_Sun::EnableOn()) return false;
|
||||
@@ -1021,16 +1043,13 @@ bool ON_Sun::operator == (const ON_Sun& sun) const
|
||||
ON_Sun::LocalDateTime(y1, m1, d1, h1);
|
||||
sun.ON_Sun::LocalDateTime(y2, m2, d2, h2);
|
||||
|
||||
if ((y1 != y2) || (m1 != m2) || (d1 != d2))
|
||||
return false;
|
||||
|
||||
if (!IsDoubleEqual(h1, h2))
|
||||
if ((y1 != y2) || (m1 != m2) || (d1 != d2) || !IsDoubleEqual(h1, h2))
|
||||
return false;
|
||||
|
||||
if (_impl->IsUsingManualControl())
|
||||
{
|
||||
if (!IsDoubleEqual(ON_Sun::Azimuth() , sun.ON_Sun::Azimuth())) return false;
|
||||
if (!IsDoubleEqual(ON_Sun::Altitude() , sun.ON_Sun::Altitude())) return false;
|
||||
if (!IsDoubleEqual(ON_Sun::Azimuth() , sun.ON_Sun::Azimuth())) return false;
|
||||
if (!IsDoubleEqual(ON_Sun::Altitude(), sun.ON_Sun::Altitude())) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1474,3 +1493,74 @@ void ON_Sun::OnInternalXmlChanged(const ON_Sun* sun)
|
||||
SetLongitude(sun->Longitude());
|
||||
}
|
||||
}
|
||||
|
||||
static const int SunVersion = 1;
|
||||
|
||||
bool ON_Sun::WriteToArchive(ON_BinaryArchive& archive) const
|
||||
{
|
||||
if (!archive.WriteInt(SunVersion))
|
||||
return false;
|
||||
|
||||
ON_XMLRootNode root;
|
||||
SaveToXMLNode(root);
|
||||
|
||||
auto length_wide = root.WriteToStream(nullptr, 0);
|
||||
if (length_wide <= 0)
|
||||
return false;
|
||||
|
||||
ON_wString sXML;
|
||||
sXML.ReserveArray(size_t(length_wide + 1));
|
||||
length_wide = root.WriteToStream(sXML.Array(), length_wide);
|
||||
if (length_wide <= 0)
|
||||
return false;
|
||||
|
||||
const auto* wsz = static_cast<const wchar_t*>(sXML);
|
||||
|
||||
const auto length_utf8 = ON_ConvertWideCharToUTF8(false, wsz, -1, nullptr, 0, nullptr, 0, 0, nullptr);
|
||||
auto utf8 = std::unique_ptr<char[]>(new char[length_utf8]);
|
||||
auto* pUTF8 = utf8.get();
|
||||
ON_ConvertWideCharToUTF8(false, wsz, -1, pUTF8, length_utf8, nullptr, 0, 0, nullptr);
|
||||
|
||||
// Write the length of the UTF8 buffer to the archive.
|
||||
if (!archive.WriteInt(length_utf8))
|
||||
return false;
|
||||
|
||||
// Write the UTF8 buffer to the archive.
|
||||
if (!archive.WriteChar(length_utf8, pUTF8))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ON_Sun::ReadFromArchive(ON_BinaryArchive& archive)
|
||||
{
|
||||
int version = 0;
|
||||
if (!archive.ReadInt(&version))
|
||||
return false;
|
||||
|
||||
if (SunVersion != version)
|
||||
return false;
|
||||
|
||||
int length_utf8 = 0;
|
||||
if (!archive.ReadInt(&length_utf8))
|
||||
return false;
|
||||
|
||||
auto utf8 = std::unique_ptr<char[]>(new char[size_t(length_utf8)+1]);
|
||||
auto* pUTF8 = utf8.get();
|
||||
|
||||
if (!archive.ReadChar(length_utf8, pUTF8))
|
||||
return false;
|
||||
|
||||
pUTF8[length_utf8] = 0; // Terminator.
|
||||
|
||||
const auto length_wide = ON_ConvertUTF8ToWideChar(false, pUTF8, -1, nullptr, 0, nullptr, 0, 0, nullptr);
|
||||
auto wide = std::unique_ptr<wchar_t[]>(new wchar_t[length_wide + 1]);
|
||||
auto* pWide = wide.get();
|
||||
ON_ConvertUTF8ToWideChar(false, pUTF8, -1, pWide, length_wide + 1, nullptr, 0, 0, nullptr);
|
||||
|
||||
ON_XMLRootNode root;
|
||||
root.ReadFromStream(pWide);
|
||||
LoadFromXMLNode(root);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -251,6 +251,12 @@ public:
|
||||
// Save the sun properties to a 'sun' XML node.
|
||||
virtual void SaveToXMLNode(ON_XMLNode& node) const;
|
||||
|
||||
// Write the sun properties to an archive.
|
||||
virtual bool WriteToArchive(ON_BinaryArchive& archive) const;
|
||||
|
||||
// Read the sun properties from an archive that was created by WriteToArchive().
|
||||
virtual bool ReadFromArchive(ON_BinaryArchive& archive);
|
||||
|
||||
// Emergency virtual function for future expansion.
|
||||
virtual void* EVF(const wchar_t* func, void* data);
|
||||
|
||||
|
||||
@@ -337,6 +337,8 @@ public:
|
||||
pbr_displacement_texture = 28U,
|
||||
pbr_clearcoat_bump_texture = 29U,
|
||||
pbr_alpha_texture = 30U,
|
||||
pbr_opacity_texture = 3U,
|
||||
pbr_bump_texture = 2U,
|
||||
|
||||
// emap_texture is OBSOLETE - set m_mapping_channel_id = ON_MappingChannel::emap_mapping
|
||||
emap_texture = 86U // spherical environment mapping.
|
||||
|
||||
@@ -5374,4 +5374,15 @@ void* ON_RdkDocumentDefaults::EVF(const wchar_t*, void*)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ON_XMLParamBlock::ON_XMLParamBlock()
|
||||
:
|
||||
_reserved(0),
|
||||
ON_XMLParameters(_node)
|
||||
{
|
||||
}
|
||||
|
||||
ON_XMLParamBlock::~ON_XMLParamBlock()
|
||||
{
|
||||
}
|
||||
|
||||
#pragma ON_PRAGMA_WARNING_POP
|
||||
|
||||
@@ -847,6 +847,18 @@ protected:
|
||||
virtual ON_XMLNode* FindNodeByNameProperty(const wchar_t* param_name) const;
|
||||
};
|
||||
|
||||
// Class ON_XMLParamBlock is ON_XMLParameters with a built-in XML node.
|
||||
class ON_CLASS ON_XMLParamBlock : public ON_XMLParameters
|
||||
{
|
||||
public:
|
||||
ON_XMLParamBlock();
|
||||
virtual ~ON_XMLParamBlock();
|
||||
|
||||
private:
|
||||
ON_XMLRootNode _node;
|
||||
ON__UINT64 _reserved;
|
||||
};
|
||||
|
||||
ON_DECL bool ON_RunXMLTests(const wchar_t* test_folder);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user