Skip to content

Commit

Permalink
remove protobuf dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Change72 committed Mar 7, 2024
1 parent db5fc21 commit 48c5f8e
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 1,604 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,6 @@ message(STATUS "GEOS: Archives output: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include_directories(BEFORE third_party/protobuf)
add_subdirectory(third_party/protobuf)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
#-----------------------------------------------------------------------------
# C++ language version and compilation flags
Expand Down
17 changes: 0 additions & 17 deletions proto/treeNode.proto

This file was deleted.

2 changes: 1 addition & 1 deletion tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ unset(_sources)

find_package(Threads)

target_link_libraries(test_geos_unit PRIVATE geos geos_c Threads::Threads protobuf::libprotobuf)
target_link_libraries(test_geos_unit PRIVATE geos geos_c Threads::Threads)
target_include_directories(test_geos_unit
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>)
Expand Down
48 changes: 0 additions & 48 deletions tests/unit/index/strtree/SimpleSTRtreeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <sys/time.h>
#include <unistd.h>
#endif
#include "treeNode.pb.h"
#include <google/protobuf/io/coded_stream.h>
// get current process pid
inline int GetCurrentPid()
Expand Down Expand Up @@ -227,40 +226,6 @@ return mem / 1024.0 / 1024.0;
#endif
}

void serialize(geos::index::strtree::SimpleSTRnode3d *node_ptr, Tree &serializeList) {
geos::geom::Envelope3d *bounds = (geom::Envelope3d *) node_ptr->getBounds();
std::size_t nChildren = node_ptr->getChildNodes().size();
TreeNode signleNode;
signleNode.set_level((int) node_ptr->getLevel());
signleNode.set_childsize((int) node_ptr->getChildNodes().size());
signleNode.set_minx(bounds->getMinX());
signleNode.set_maxx(bounds->getMaxX());
signleNode.set_miny(bounds->getMinY());
signleNode.set_maxy(bounds->getMaxY());
signleNode.set_minz(bounds->getMinZ());
signleNode.set_maxz(bounds->getMaxZ());
signleNode.set_slice_id((int) bounds->getSliceId());

serializeList.add_treenodes()->CopyFrom(signleNode);
for (std::size_t j = 0; j < nChildren; j++) {
serialize(node_ptr->getChildNodes()[j], serializeList);
}
}

void deSerialize(geos::index::strtree::SimpleSTRnode3d *&node_ptr, Tree *serializeList, int &seq) {
const TreeNode &node = (*serializeList).treenodes(seq);
geos::geom::Envelope3d e(node.minx(), node.maxx(), node.miny(), node.maxy(), node.minz(), node.maxz(), node.slice_id());
node_ptr = new geos::index::strtree::SimpleSTRnode3d(static_cast<size_t>(node.level()), &e,
static_cast<void *>(&e));
if (node.childsize() != 0) {
for (int j = 0; j < node.childsize(); j++) {
geos::index::strtree::SimpleSTRnode3d *child = nullptr;
seq = seq + 1;
deSerialize(child, serializeList, seq);
node_ptr->addChildNode3d(child);
}
}
}


template<>
Expand All @@ -284,19 +249,6 @@ void object::test<4>
}
}
t.getRoot3d();
Tree serializeList;
serialize(t.root3d, serializeList);
std::string serializeString;
serializeList.SerializeToString(&serializeString);

Tree readSerializeList;
geos::index::strtree::SimpleSTRnode3d *root_node = nullptr;
if (!readSerializeList.ParseFromString(serializeString)) {
std::cerr << "Failed to parse file." << std::endl;
}
int seq = 0;
deSerialize(root_node, &readSerializeList, seq);
std::cout << "deSerialize successfully" << std::endl;

}

Expand Down
Loading

0 comments on commit 48c5f8e

Please sign in to comment.