Skip to content

Commit

Permalink
some fix
Browse files Browse the repository at this point in the history
  • Loading branch information
miya0001 committed Apr 7, 2023
1 parent d6b693d commit 1547b26
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 47 deletions.
Binary file modified extensions/geolonia/gui/geolonia/geolonia-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified extensions/geolonia/gui/geolonia/geolonia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,6 @@ const Message = {

const AvailableLocales = ['en', 'ja', 'ja-Hira'];

const style = {
"version": 8,
"sources": {
"japan": {
"type": "vector",
"url": "https://cdn.geolonia.com/tiles/japanese-prefectures.json"
}
},
"glyphs": "https://glyphs.geolonia.com/{fontstack}/{range}.pbf",
"layers": [
{
"id": "background",
"type": "background",
"paint": {
"background-color": "#222222"
}
},
{
"id": "prefs",
"type": "fill",
"source": "japan",
"source-layer": "prefectures",
"paint": {
"fill-color": "#333333",
"fill-outline-color": "#444444"
}
},
{
id: 'point-pref',
type: 'circle',
source: "japan",
"source-layer": "admins",
paint: {
'circle-radius': 4,
'circle-color': 'rgba(255, 255, 255, 0.6)',
},
}
],
}

class Scratch3GeoloniaBlocks {
constructor (runtime) {
this.runtime = runtime;
Expand Down Expand Up @@ -88,6 +48,25 @@ class Scratch3GeoloniaBlocks {
},
}
},
{
opcode: 'addLayer',
blockType: BlockType.COMMAND,
text: 'レイヤー [LAYER] を 色 [COLOR] 透明度 [OPACITY] で表示',
arguments: {
LAYER: {
type: ArgumentType.STRING,
defaultValue: '都市計画区域界',
},
COLOR: {
type: ArgumentType.COLOR,
defaultValue: '#FF0000',
},
OPACITY: {
type: ArgumentType.NUMBER,
defaultValue: 0.4,
},
}
},
{
opcode: 'flyTo',
blockType: BlockType.COMMAND,
Expand Down Expand Up @@ -224,13 +203,6 @@ class Scratch3GeoloniaBlocks {
mapContainer.appendChild(div);

this.map = {}
// this.map = new city.Takamatsu.Map({
// container: '#geolonia-map',
// style: 'https://raw.githubusercontent.com/geolonia/scratch-style/main/style.json',
// center: [args.LNG, args.LAT],
// zoom: args.ZOOM,
// pitch: 0,
// });

this.map = new city.Takamatsu.Map({
container: 'geolonia-map',
Expand Down Expand Up @@ -264,6 +236,18 @@ class Scratch3GeoloniaBlocks {
})
}

addLayer(args) {
if (!this.loaded) {
console.error('まず地図を表示してください。')
return
}

this.map.loadData(args.LAYER, {
'fill-color': args.COLOR,
'fill-opacity': Number(args.OPACITY),
})
}

zoomTo(args) {
if (!this.loaded) {
console.error('まず地図を表示してください。')
Expand Down
Binary file modified src/lib/libraries/extensions/geolonia/geolonia-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/lib/libraries/extensions/geolonia/geolonia.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1547b26

Please sign in to comment.