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

refactor: Refactored Geometry models in swift & optional/nullable properties of the recently committed swift class. #485

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
31 changes: 31 additions & 0 deletions Sources/GoogleMapsUtils/Geometry/Models/GMUFeature1.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import GoogleMaps

/// Instances of this class represent a GeoJSON Feature object.
/// TO-DO: Rename the class to `GMUFeature` once the linking is done and remove the objective c class.
struct GMUFeature1: GMUGeometryContainer1 {
// MARK: - Properties
/// The geometry object in the container.
var geometry: GMUGeometry
/// Style information that should be applied to the contained geometry object.
var style: GMUStyle?
/// The identifier of the feature.
private(set) var identifier: String?
/// The properties of the geometry in the feature.
private(set) var properties: [String : AnyObject]?
/// The bounding box of the geometry in the feature.
private(set) var boundingBox: GMSCoordinateBounds?
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


/// Instances of this class represent a GeometryCollection object.
/// TO-DO: Rename the class to `GMUGeometryCollection` once the linking is done and remove the objective c class.
struct GMUGeometryCollection1: GMUGeometry1 {
// MARK: - Properties
/// The type of the geometry.
var type: String = "GeometryCollection"
/// The array of geometry objects for the GeometryCollection.
private(set) var geometries: [GMUGeometry]
}

31 changes: 31 additions & 0 deletions Sources/GoogleMapsUtils/Geometry/Models/GMUGroundOverlay1.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// Instances of this class represent a Ground Overlay object.
/// TO-DO: Rename the class to `GMUGroundOverlay` once the linking is done and remove the objective c class.
struct GMUGroundOverlay1: GMUGeometry1 {
// MARK: - Properties
/// The type of the geometry.
var type: String = "GroundOverlay"
/// The North-East corner of the overlay.
private(set) var northEast: CLLocationCoordinate2D
/// The South-West corner of the overlay.
private(set) var southWest: CLLocationCoordinate2D
/// The Z-Index of the overlay.
private(set) var zIndex: Int
/// The rotation of the overlay on the map.
private(set) var rotation: Double
/// The image to be rendered on the overlay.
private(set) var href: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import GoogleMaps
struct GMULineString1: GMUGeometry1 {
// MARK: - Properties
/// The type of the geometry.
var type: String
var type: String = "LineString"
/// The path of the LineString.
private(set) var path: GMSPath
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/GoogleMapsUtils/Geometry/Models/GMUPlacemark1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@

/// Represents a placemark which is either a Point, LineString, Polygon, or MultiGeometry. Contains
/// the properties and styles of the place.
/// TO-DO: Rename the class to `GMUPlacemarkSwift & GMUGeometryContainer` once the linking is done and remove the objective c class.
/// TO-DO: Rename the class to `GMUPlacemarkSwift` once the linking is done and remove the objective c class.
struct GMUPlacemark1: GMUGeometryContainer1 {
// MARK: - Properties
/// The geometry object in the container.
var geometry: GMUGeometry
/// Style information that should be applied to the contained geometry object.
var style: GMUStyle
var style: GMUStyle?
/// The name element of the placemark.
private(set) var title: String
private(set) var title: String?
/// The description element of the placemark.
private(set) var snippet: String
private(set) var snippet: String?
/// The StyleUrl element of the placemark; used to reference a style defined in the file.
private(set) var styleUrl: String
private(set) var styleUrl: String?

}
24 changes: 24 additions & 0 deletions Sources/GoogleMapsUtils/Geometry/Models/GMUPoint1.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// Instances of this class represent a GeoJSON Feature object.
/// TO-DO: Rename the class to `GMUPoint` once the linking is done and remove the objective c class.
struct GMUPoint1: GMUGeometry1 {
// MARK: - Properties
/// The type of the geometry.
var type: String = "Point"
/// The 2D coordinate of the Point, containing a latitude and longitude.
private(set) var coordinate: CLLocationCoordinate2D
}

25 changes: 25 additions & 0 deletions Sources/GoogleMapsUtils/Geometry/Models/GMUPolygon1.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import GoogleMaps

/// Instances of this class represent a Polygon object.
/// TO-DO: Rename the class to `GMUPolygon` once the linking is done and remove the objective c class.
struct GMUPolygon1: GMUGeometry1 {
// MARK: - Properties
/// The type of the geometry.
var type: String = "Polygon"
/// The array of LinearRing paths for the Polygon. The first is the exterior ring of the Polygon; any subsequent rings are holes.
private(set) var paths: [GMSPath]
}
8 changes: 4 additions & 4 deletions Sources/GoogleMapsUtils/Geometry/Models/GMUStyle1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ struct GMUStyle1 {
/// The unique identifier of the style
private(set) var styleID: String
/// The color for the stroke of a LineString or Polygon.
private(set) var strokeColor: UIColor
private(set) var strokeColor: UIColor?
/// The color for the fill of a Polygon.
private(set) var fillColor: UIColor
private(set) var fillColor: UIColor?
/// The width of a LineString
private(set) var width: Float
/// The scale that a Point's icon should be rendered at.
Expand All @@ -33,9 +33,9 @@ struct GMUStyle1 {
/// The position within an icon that is anchored to the Point.
private(set) var anchor: CGPoint
/// The href for the icon to be used for a Point.
private(set) var iconUrl: String
private(set) var iconUrl: String?
/// The title to use for a Point.
private(set) var title: String
private(set) var title: String?
/// Whether the Polygon has a defined fill color.
private(set) var hasFill: Bool
/// Whether the LineString or Polygon has a defined stroke color.
Expand Down
23 changes: 23 additions & 0 deletions Sources/GoogleMapsUtils/Geometry/Models/GMUStyleMap1.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/// TO-DO: Rename the class to `GMUStyleMap` once the linking is done and remove the objective c class.
struct GMUStyleMap1 {
// MARK: - Properties
/// The styleMapId of the geometry.
private(set) var styleMapId: String
/// The array of pairs for the GMUPair
/// TO-DO: Rename the class to `GMUPair` once the linking is done and remove the objective c class.
private(set) var pairs: [GMUPair1]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


/// Defines a generic geometry object.
/// TO-DO: Rename the class to `GMUGeometryContainer` once the linking is done and remove the objective c class.
/// TO-DO: Rename the class to `GMUGeometry` once the linking is done and remove the objective c class.
protocol GMUGeometry1 {
/// The type of the geometry.
var type: String { get }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ protocol GMUGeometryContainer1 {
/// The geometry object in the container.
var geometry: GMUGeometry { get }
/// Style information that should be applied to the contained geometry object.
var style: GMUStyle { get set }
var style: GMUStyle? { get set }
}