This commit is contained in:
oguzhankoral 2023-11-29 03:48:03 +03:00
Родитель 92a941a944
Коммит 188794af8d
3 изменённых файлов: 39 добавлений и 1 удалений

Просмотреть файл

@ -33,4 +33,6 @@ module SpeckleConnector
OBJECTS_OTHER_DISPLAYSTYLE = 'Objects.Other.DisplayStyle'
SPECKLE_CORE_MODELS_COLLECTION = 'Speckle.Core.Models.Collection'
SPECKLE_CORE_MODELS_COLLECTION_RASTER_LAYER = 'Speckle.Core.Models.Collection:Objects.GIS.RasterLayer'
SPECKLE_CORE_MODELS_COLLECTION_VECTOR_LAYER = 'Speckle.Core.Models.Collection:Objects.GIS.VectorLayer'
end

Просмотреть файл

@ -19,6 +19,7 @@ require_relative '../speckle_objects/geometry/mesh'
require_relative '../speckle_objects/built_elements/view3d'
require_relative '../speckle_objects/built_elements/network'
require_relative '../speckle_objects/speckle/core/models/collection'
require_relative '../speckle_objects/speckle/core/models/vector_layer_collection'
require_relative '../sketchup_model/dictionary/speckle_entity_dictionary_handler'
module SpeckleConnector
@ -65,6 +66,7 @@ module SpeckleConnector
VIEW3D = BUILTELEMENTS::View3d
POLYGON_ELEMENT = GIS::PolygonElement
COLLECTION = SpeckleObjects::Speckle::Core::Models::Collection
VECTOR_LAYER_COLLECTION = SpeckleObjects::Speckle::Core::Models::VectorLayerCollection
BASE_OBJECT_PROPS = %w[applicationId id speckle_type totalChildrenCount].freeze
CONVERTABLE_SPECKLE_TYPES = %w[
@ -85,6 +87,8 @@ module SpeckleConnector
Objects.BuiltElements.Network
Objects.GIS.PolygonElement
Speckle.Core.Models.Collection
Speckle.Core.Models.Collection:Objects.GIS.RasterLayer
Speckle.Core.Models.Collection:Objects.GIS.VectorLayer
].freeze
def from_revit
@ -303,7 +307,9 @@ module SpeckleConnector
OBJECTS_BUILTELEMENTS_REVIT_DIRECTSHAPE => BUILTELEMENTS::Revit::DirectShape.method(:to_native),
OBJECTS_BUILTELEMENTS_NETWORK => BUILTELEMENTS::Network.method(:to_native),
OBJECTS_GIS_POLYGONELEMENT => POLYGON_ELEMENT.method(:to_native),
SPECKLE_CORE_MODELS_COLLECTION => COLLECTION.method(:to_native)
SPECKLE_CORE_MODELS_COLLECTION => COLLECTION.method(:to_native),
SPECKLE_CORE_MODELS_COLLECTION_RASTER_LAYER => COLLECTION.method(:to_native),
SPECKLE_CORE_MODELS_COLLECTION_VECTOR_LAYER => VECTOR_LAYER_COLLECTION.method(:to_native)
}.freeze
# @param state [States::State] state of the speckle application

Просмотреть файл

@ -0,0 +1,30 @@
# frozen_string_literal: true
require_relative 'collection'
module SpeckleConnector
module SpeckleObjects
module Speckle
module Core
module Models
# VectorLayerCollection object that collect GIS vector elements under it's elements.
class VectorLayerCollection < Collection
SPECKLE_TYPE = 'Speckle.Core.Models.Collection:Objects.GIS.VectorLayer'
# @param state [States::State] state of the Speckle application.
def self.to_native(state, vector_layer_collection, layer_or_folder, entities, &convert_to_native)
elements = vector_layer_collection['elements']
elements.each do |element|
new_state, _converted_entities = convert_to_native.call(state, element, layer_or_folder, entities)
state = new_state
end
return state, []
end
end
end
end
end
end
end