Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow App to specify GCS asset Dir #748

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
44ec5a9
add logging GCS
DanRod1999 May 3, 2024
0f15e86
undo comment
DanRod1999 May 3, 2024
1765575
remove unneeded var, fix typo
DanRod1999 May 3, 2024
1a2eb8c
Merge branch 'main' into dan/gcs-logging
DanRod1999 May 3, 2024
e5b1194
modify log for in workspace
DanRod1999 May 3, 2024
0ba5ddd
allow alternate gcs path through env var
DanRod1999 May 3, 2024
6b85c46
Merge branch 'main' into dan/gcs-logging
DanRod1999 May 7, 2024
34ba52d
Merge branch 'main' into dan/gcs-logging
DanRod1999 May 8, 2024
c3e3fa5
fix error
DanRod1999 May 8, 2024
65fc8bc
Merge branch 'dan/gcs-logging' of https://github.com/iTwin/imodel-nat…
DanRod1999 May 8, 2024
0fdc566
Merge branch 'main' into dan/gcs-logging
DanRod1999 May 13, 2024
2c48e11
Merge branch 'main' into dan/gcs-logging
DanRod1999 May 23, 2024
6621d9b
Merge branch 'main' into dan/gcs-logging
DanRod1999 May 28, 2024
54af621
add setGeoCoordAssetDir
DanRod1999 May 31, 2024
2fee4af
create setGeoCoordAssetDir
DanRod1999 Jun 4, 2024
f8febd8
Merge branch 'main' into dan/setGeoCoordDir
DanRod1999 Jun 4, 2024
9366fe4
fix failing tests
DanRod1999 Jun 6, 2024
3c65a45
add terminate
DanRod1999 Jun 11, 2024
7d835f5
Revert "add setGeoCoordAssetDir"
DanRod1999 Jun 11, 2024
8f2c213
Merge branch 'dan/setGeoCoordDir' into dan/gcs-logging
DanRod1999 Jun 11, 2024
8a6c348
remove get env
DanRod1999 Jun 11, 2024
b6332c6
Merge branch 'main' into dan/gcs-logging
DanRod1999 Jun 11, 2024
b55ca79
shutdown GCS on terminate
DanRod1999 Jun 11, 2024
347760b
add file path
DanRod1999 Jun 11, 2024
73fcf21
clean up comments
DanRod1999 Jun 11, 2024
33e2022
add comments
DanRod1999 Jun 12, 2024
caa09d2
Merge branch 'main' into dan/gcs-logging
DanRod1999 Jun 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion iModelCore/GeoCoord/BaseGeoCoord/basegeocoord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8946,7 +8946,10 @@ struct GeoCoordWorkspaces {
Logging::LogMessageV("GeoCoord", LOG_ERROR, "Unable to read data for GCS file %s from workspace %s, rc=%d", path, row.db->GetDbFileName(), rc);
delete resource; // weren't able to read from row.
}
Logging::LogMessageV("GeoCoord", LOG_WARNING, "Unable to find GCS file %s in any workspace", path);
if (BentleyApi::GeoCoordinates::s_loadLocalFiles)
nick4598 marked this conversation as resolved.
Show resolved Hide resolved
Logging::LogMessageV("GeoCoord", LOG_INFO, "Unable to find GCS file %s in any workspace, trying local file", path);
else
Logging::LogMessageV("GeoCoord", LOG_WARNING, "Unable to find GCS file %s in any workspace", path);
return nullptr;
}

Expand Down Expand Up @@ -9017,6 +9020,9 @@ StatusInt BaseGCS::Initialize(Utf8CP dataDirectory) {
::CS_gpfnm("GeodeticPath.dty");
::CS_altdr(s_assetsDirPrefix.c_str());
s_assetsDir = dataDirectory;
if(getenv("GEOCOORD_DIR")){
s_assetsDir = getenv("GEOCOORD_DIR");
}

#if defined (BENTLEY_WIN32)||defined (BENTLEY_WINRT)
if (s_assetsDir.StartsWith("\\\\?\\")) // fopen doesn't work correctly with long path prefix on Windows
Expand Down Expand Up @@ -27323,6 +27329,11 @@ _csFile* CS_fopen(Utf8CP filename, Utf8CP mode) {

auto name = BentleyApi::GeoCoordinates::toAssetName(filename);
auto file = CS_fopen_caseInsensitive(name.c_str(), mode);
if (file != nullptr)
Logging::LogMessageV("GeoCoord", LOG_INFO, "Successfully loaded GCS file %s from %s", filename, name.c_str());
else
Logging::LogMessageV("GeoCoord", LOG_WARNING, "Unable to find GCS file %s in Workspace or locally", filename);

return nullptr == file ? nullptr : new AssetDirFile(file);
}

Expand Down
5 changes: 5 additions & 0 deletions iModelCore/iModelPlatform/DgnGeoCoord/DgnGeoCoord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5340,7 +5340,12 @@ DgnGCSP DgnGCS::FromProject(DgnDbR project)
ScopedArray<Byte> buffer(propSize);
project.QueryProperty(buffer.GetData(), propSize, DgnProjectProperty::DgnGCS());

StopWatch timer;
timer.Start();
auto gcs = FromGeoCoordType66AppData((short const*)buffer.GetData(), project);
timer.Stop();
Logging::LogMessageV("GeoCoord", LOG_INFO, "Time to load gcs: %fs", timer.GetElapsedSeconds());

if (NULL == gcs)
{
project.AddAppData(NotFoundAppData::GetKey(), new NotFoundAppData());
Expand Down