Skip to content

Commit

Permalink
Merged pull request #25 from trajectoryjp/develop
Browse files Browse the repository at this point in the history
Release v4.0.0
  • Loading branch information
HarutakaMatsumoto authored Jun 7, 2024
2 parents ad20a88 + 009e50f commit 7e7908c
Show file tree
Hide file tree
Showing 26 changed files with 759 additions and 280 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* 任意の空間IDの周辺の空間IDを取得する機能
* 任意の形状から空間IDを取得する機能
* 空間IDをquadkeyと2分木におけるbit形式のIDに変換する機能
* 空間ID仕様については[Digital Architecture Design Center 3次元空間情報基盤アーキテクチャ検討会 会議資料](https://www.ipa.go.jp/dadc/architecture/pdf/pj_report_3dspatialinfo_doc-appendix_202212_1.pdf)を参照して下さい。
* 空間ID仕様については[Digital Architecture Design Center 3次元空間情報基盤アーキテクチャ検討会 会議資料](https://www.ipa.go.jp/digital/architecture/Individual-link/ps6vr7000000qmcv-att/pj_report_3dspatialinfo_doc-appendix_202212_1.pdf)を参照して下さい。


## 注意事項
Expand Down
2 changes: 1 addition & 1 deletion common/object/coordinate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package object
import (
"math"

"github.com/trajectoryjp/spatial_id_go/v3/common/errors"
"github.com/trajectoryjp/spatial_id_go/v4/common/errors"
)

// Point 地理座標用の構造体
Expand Down
98 changes: 49 additions & 49 deletions common/object/id_object.go
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
// 拡張空間IDパッケージ
package object

// FromExtendedSpatialIDToQuadkeyAndAltitudekey 拡張空間IDから変換したquadkeyと標高のIDの組み合わせを管理する構造体
// FromExtendedSpatialIDToQuadkeyAndAltitudekey 拡張空間IDから変換したquadkeyとaltitudekeyの組み合わせを管理する構造体
type FromExtendedSpatialIDToQuadkeyAndAltitudekey struct {
// quadkey zoom level / quadkeyの精度
// quadkeyの精度
quadkeyZoom int64
// a list of quadkey-altitude key sets [[quadkey, altitudekey]...]
// innerIDList [[quadkey, altitudekey]...]
innerIDList [][2]int64
// altitudekey zoom level / 高さ方向の精度
// altitudekeyの精度
altitudekeyZoom int64
// altitude range scalar is s, where 2^25-s = altitude range (max altitude - min altitude)
altitudeRangeScalar int64
// shifts the altitude range up or down by n units of the resulting verticalIndex
verticalIndexOffset int64
// altitudekeyの高さが1mとなるズームレベル
zBaseExponent int64
// ズームレベルがzBaseExponentで高度0mにおけるaltitudekey
zBaseOffset int64
}

// NewFromExtendedSpatialIDToQuadkeyAndVerticalID FromExtendedSpatialIDToQuadkeyAndVerticalID初期化関数
//
// input 引数:
//
// quadkeyZoom: quadkey zoom level / quadkeyの精度
// innerIDList: [[quadkey,vIndex]...]
// altitudekeyZoom: // altitudekey zoom level / 高さ方向の精度
// altitudeRangeScalar: altitude range scalar is s, where 2^25-s = altitude range (max altitude - min altitude)
// verticalIndexOffset : shifts the altitude range up or down by n units of the resulting verticalIndex
// quadkeyZoom: quadkeyの精度
// innerIDList [[quadkey, altitudekey]...]
// altitudekeyZoom: altitudekeyの精度
// zBaseExponent: altitudekeyの高さが1mとなるズームレベル
// zBaseOffset: ズームレベルがzBaseExponentで高度0mにおけるaltitudekey
//
// output 戻り値:
//
// 初期化したFromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクト
func NewFromExtendedSpatialIDToQuadkeyAndAltitudekey(quadkeyZoom int64, innerIDList [][2]int64, altitudekeyZoom int64, altitudeRangeScalar int64, verticalIndexOffset int64) *FromExtendedSpatialIDToQuadkeyAndAltitudekey {
func NewFromExtendedSpatialIDToQuadkeyAndAltitudekey(quadkeyZoom int64, innerIDList [][2]int64, altitudekeyZoom int64, zBaseExponent int64, zBaseOffset int64) *FromExtendedSpatialIDToQuadkeyAndAltitudekey {
a := &FromExtendedSpatialIDToQuadkeyAndAltitudekey{}
a.SetQuadkeyZoom(quadkeyZoom)
a.SetInnerIDList(innerIDList)
a.SetVerticalZoom(altitudekeyZoom)
a.SetAltitudeRangeScalar(altitudeRangeScalar)
a.SetVerticalIndexOffset(verticalIndexOffset)
a.SetAltitudekeyZoom(altitudekeyZoom)
a.SetZBaseExponent(zBaseExponent)
a.SetZBaseOffset(zBaseOffset)
return a
}

// SetQuadkeyZoom 水平精度設定関数
// SetQuadkeyZoom quadkeyの精度設定関数
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトのquadkeyZoomを引数の入力値に設定する。
//
Expand All @@ -60,40 +60,40 @@ func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) SetInnerIDList(innerIDLis
a.innerIDList = innerIDList
}

// SetVerticalZoom 垂直精度設定関数
// SetAltitudeZoom altitudekeyの精度設定関数
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトのVerticalZoomを引数の入力値に設定する
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトのaltitudeKeyZoomを引数の入力値に設定する
//
// input 引数:
//
// vZoom:垂直精度
func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) SetVerticalZoom(altitudekeyZoom int64) {
// altitudekeyZoom:altitudekeyの精度
func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) SetAltitudekeyZoom(altitudekeyZoom int64) {
a.altitudekeyZoom = altitudekeyZoom
}

// SetAltitudeRangeScalar
// SetZBaseExponent
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトのVerticalZoomを引数の入力値に設定する
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトのzBaseExponentを引数の入力値に設定する
//
// input 引数:
//
// altitudeRangeScalar
func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) SetAltitudeRangeScalar(aScalar int64) {
a.altitudeRangeScalar = aScalar
// zBaseExponent: altitudekeyの高さが1mとなるズームレベル
func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) SetZBaseExponent(zBaseExponent int64) {
a.zBaseExponent = zBaseExponent
}

// SetVerticalIndexOffset
// SetZBaseOffset
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトのVerticalZoomを引数の入力値に設定する
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトのzBaseOffsetを引数の入力値に設定する
//
// input 引数:
//
// vZoom:垂直精度
func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) SetVerticalIndexOffset(verticalIndexOffset int64) {
a.verticalIndexOffset = verticalIndexOffset
// zBaseOffset: ズームレベルがzBaseExponentで高度0mにおけるaltitudekey
func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) SetZBaseOffset(zBaseOffset int64) {
a.zBaseOffset = zBaseOffset
}

// QuadkeyZoom QuadkeyZoom設定値取得関数
// QuadkeyZoom quadkeyZoom設定値取得関数
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているquadkeyZoomの値を取得する。
//
Expand All @@ -104,48 +104,48 @@ func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) QuadkeyZoom() int64 {
return a.quadkeyZoom
}

// InnerIDList InnerIDList設定値取得関数
// InnerIDList innerIDList設定値取得関数
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているInnerIDListの値を取得する
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているinnerIDListの値を取得する
//
// output 戻り値:
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているInnerIDListの値
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているinnerIDListの値
func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) InnerIDList() [][2]int64 {
return a.innerIDList
}

// AltitudekeyZoom AltitudekeyZoom設定値取得関数
// AltitudekeyZoom altitudekeyZoom設定値取得関数
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているAltitudekeyZoomの値を取得する
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているaltitudekeyZoomの値を取得する
//
// output 戻り値:
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているAltitudekeyZoomの値
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているaltitudekeyZoomの値
func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) AltitudekeyZoom() int64 {
return a.altitudekeyZoom
}

// AltitudeRangeScalar AltitudeRangeScalar設定値取得関数
// ZBaseExponent zBaseExponent設定値取得関数
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているAltitudeRangeScalarの値を取得する
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているzBaseExponentの値を取得する
//
// output 戻り値:
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているAltitudeRangeScalarの値
func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) AltitudeRangeScalar() int64 {
return a.altitudeRangeScalar
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているzBaseExponentの値
func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) ZBaseExponent() int64 {
return a.zBaseExponent
}

// VerticalIndexOffset VerticalIndexOffset設定値取得関数
// ZBaseOffset zBaseOffset設定値取得関数
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているVerticalIndexOffsetの値を取得する
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているzBaseOffsetの値を取得する
//
// output 戻り値:
//
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているVerticalIndexOffsetの値
func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) VerticalIndexOffset() int64 {
return a.verticalIndexOffset
// FromExtendedSpatialIDToQuadkeyAndAltitudekeyオブジェクトに設定されているzBaseOffsetの値
func (a *FromExtendedSpatialIDToQuadkeyAndAltitudekey) ZBaseOffset() int64 {
return a.zBaseOffset
}

// FromExtendedSpatialIDToQuadkeyAndVerticalID 拡張空間IDから変換したquadkeyと高さのIDの組み合わせを管理する構造体
Expand Down
4 changes: 2 additions & 2 deletions common/object/spatial_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"strconv"
"strings"

"github.com/trajectoryjp/spatial_id_go/v3/common/consts"
"github.com/trajectoryjp/spatial_id_go/v3/common/errors"
"github.com/trajectoryjp/spatial_id_go/v4/common/consts"
"github.com/trajectoryjp/spatial_id_go/v4/common/errors"
)

// ExtendedSpatialID 拡張空間IDクラス
Expand Down
4 changes: 2 additions & 2 deletions common/spatial/point3.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
package spatial

import (
"github.com/trajectoryjp/spatial_id_go/v3/common"
"github.com/trajectoryjp/spatial_id_go/v3/common/errors"
"github.com/trajectoryjp/spatial_id_go/v4/common"
"github.com/trajectoryjp/spatial_id_go/v4/common/errors"
)

// UniqueAppend 点のユニークを保持した配列追加
Expand Down
2 changes: 1 addition & 1 deletion common/spatial/quat.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package spatial
import (
"math"

"github.com/trajectoryjp/spatial_id_go/v3/common/consts"
"github.com/trajectoryjp/spatial_id_go/v4/common/consts"
)

// Quat 四元数の構造体
Expand Down
4 changes: 2 additions & 2 deletions common/spatial/quat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package spatial
import (
"testing"

"github.com/trajectoryjp/spatial_id_go/v3/common"
"github.com/trajectoryjp/spatial_id_go/v3/common/consts"
"github.com/trajectoryjp/spatial_id_go/v4/common"
"github.com/trajectoryjp/spatial_id_go/v4/common/consts"
)

// TestQuat 四元数の構造体(試験用)
Expand Down
2 changes: 1 addition & 1 deletion common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ package common
import (
"math"

"github.com/trajectoryjp/spatial_id_go/v3/common/errors"
"github.com/trajectoryjp/spatial_id_go/v4/common/errors"
)

// AlmostEqual 同値確認関数
Expand Down
4 changes: 4 additions & 0 deletions common/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,10 @@ func TestCalculateArithmaticShift(t *testing.T) {
{index: 47, shift: 0, expectedOutput: 47},
{index: 47, shift: -1, expectedOutput: 23},
{index: 47, shift: -100, expectedOutput: 0},
{index: -47, shift: 1, expectedOutput: -94},
{index: -47, shift: 0, expectedOutput: -47},
{index: -47, shift: -1, expectedOutput: -24},
{index: -47, shift: -3, expectedOutput: -6},
{index: 123456, shift: -1, expectedOutput: 61728},
}

Expand Down
2 changes: 1 addition & 1 deletion examples/checkZoom/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module checkZoom

go 1.20

require github.com/trajectoryjp/spatial_id_go/v3 v3.0.0
require github.com/trajectoryjp/spatial_id_go/v4 v4.0.0

require (
github.com/wroge/wgs84 v1.1.7 // indirect
Expand Down
2 changes: 1 addition & 1 deletion examples/checkZoom/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"

"github.com/trajectoryjp/spatial_id_go/v3/shape"
"github.com/trajectoryjp/spatial_id_go/v4/shape"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/trajectoryjp/spatial_id_go/v3
module github.com/trajectoryjp/spatial_id_go/v4

go 1.19

Expand Down
8 changes: 4 additions & 4 deletions integrate/change_zoom.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"strconv"
"strings"

"github.com/trajectoryjp/spatial_id_go/v3/common"
"github.com/trajectoryjp/spatial_id_go/v3/common/errors"
"github.com/trajectoryjp/spatial_id_go/v3/common/object"
"github.com/trajectoryjp/spatial_id_go/v3/shape"
"github.com/trajectoryjp/spatial_id_go/v4/common"
"github.com/trajectoryjp/spatial_id_go/v4/common/errors"
"github.com/trajectoryjp/spatial_id_go/v4/common/object"
"github.com/trajectoryjp/spatial_id_go/v4/shape"
)

// ChangeSpatialIdsZoom 空間IDの精度変換関数
Expand Down
10 changes: 5 additions & 5 deletions integrate/merge_zoom.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"strconv"
"strings"

"github.com/trajectoryjp/spatial_id_go/v3/common"
"github.com/trajectoryjp/spatial_id_go/v3/common/consts"
"github.com/trajectoryjp/spatial_id_go/v3/common/errors"
"github.com/trajectoryjp/spatial_id_go/v3/common/object"
"github.com/trajectoryjp/spatial_id_go/v3/shape"
"github.com/trajectoryjp/spatial_id_go/v4/common"
"github.com/trajectoryjp/spatial_id_go/v4/common/consts"
"github.com/trajectoryjp/spatial_id_go/v4/common/errors"
"github.com/trajectoryjp/spatial_id_go/v4/common/object"
"github.com/trajectoryjp/spatial_id_go/v4/shape"
)

// UnitDividedSpatialID 単位分割拡張空間ID構造体
Expand Down
2 changes: 1 addition & 1 deletion integrate/merge_zoom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"
"testing"

"github.com/trajectoryjp/spatial_id_go/v3/common/object"
"github.com/trajectoryjp/spatial_id_go/v4/common/object"
)

// TestNewUnitDividedSpatialID01 単位分割拡張空間ID構造体のコンストラクタ 正常系動作確認
Expand Down
6 changes: 3 additions & 3 deletions operated/shifting_spatial_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"strconv"
"strings"

"github.com/trajectoryjp/spatial_id_go/v3/common"
"github.com/trajectoryjp/spatial_id_go/v3/common/consts"
"github.com/trajectoryjp/spatial_id_go/v3/common/object"
"github.com/trajectoryjp/spatial_id_go/v4/common"
"github.com/trajectoryjp/spatial_id_go/v4/common/consts"
"github.com/trajectoryjp/spatial_id_go/v4/common/object"
)

// Get6spatialIdsAdjacentToFaces 拡張空間IDの面6個の拡張空間ID取得関数
Expand Down
2 changes: 1 addition & 1 deletion operated/shifting_spatial_id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"reflect"
"testing"

"github.com/trajectoryjp/spatial_id_go/v3/common"
"github.com/trajectoryjp/spatial_id_go/v4/common"
)

// TestGet6spatialIdsAdjacentToFaces01 正常系動作確認
Expand Down
10 changes: 5 additions & 5 deletions shape/line.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package shape
import (
"math"

"github.com/trajectoryjp/spatial_id_go/v3/common"
"github.com/trajectoryjp/spatial_id_go/v3/common/errors"
"github.com/trajectoryjp/spatial_id_go/v3/common/object"
"github.com/trajectoryjp/spatial_id_go/v3/common/spatial"
"github.com/trajectoryjp/spatial_id_go/v3/operated"
"github.com/trajectoryjp/spatial_id_go/v4/common"
"github.com/trajectoryjp/spatial_id_go/v4/common/errors"
"github.com/trajectoryjp/spatial_id_go/v4/common/object"
"github.com/trajectoryjp/spatial_id_go/v4/common/spatial"
"github.com/trajectoryjp/spatial_id_go/v4/operated"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions shape/line_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"fmt"
"testing"

"github.com/trajectoryjp/spatial_id_go/v3/common/enum"
"github.com/trajectoryjp/spatial_id_go/v3/common/object"
"github.com/trajectoryjp/spatial_id_go/v3/common/spatial"
"github.com/trajectoryjp/spatial_id_go/v4/common/enum"
"github.com/trajectoryjp/spatial_id_go/v4/common/object"
"github.com/trajectoryjp/spatial_id_go/v4/common/spatial"
)

// TestGetSpatialIdsOnLine01 正常系動作確認
Expand Down
10 changes: 5 additions & 5 deletions shape/point.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import (
"strconv"
"strings"

"github.com/trajectoryjp/spatial_id_go/v3/common"
"github.com/trajectoryjp/spatial_id_go/v3/common/consts"
"github.com/trajectoryjp/spatial_id_go/v3/common/enum"
"github.com/trajectoryjp/spatial_id_go/v3/common/errors"
"github.com/trajectoryjp/spatial_id_go/v3/common/object"
"github.com/trajectoryjp/spatial_id_go/v4/common"
"github.com/trajectoryjp/spatial_id_go/v4/common/consts"
"github.com/trajectoryjp/spatial_id_go/v4/common/enum"
"github.com/trajectoryjp/spatial_id_go/v4/common/errors"
"github.com/trajectoryjp/spatial_id_go/v4/common/object"

"github.com/wroge/wgs84"
)
Expand Down
Loading

0 comments on commit 7e7908c

Please sign in to comment.