提交 65ead2bf 编写于 作者: S sushuang

Fix map problem brought from geo upgrade.

上级 fa477050
......@@ -33,8 +33,9 @@ import geoSourceManager from './geoSourceManager';
* Specify the positioned areas by left, top, width, height
* @param {Object.<string, string>} [nameMap]
* Specify name alias
* @param {boolean} [invertLongitute=true]
*/
function Geo(name, map, nameMap) {
function Geo(name, map, nameMap, invertLongitute) {
View.call(this, name);
......@@ -48,6 +49,7 @@ function Geo(name, map, nameMap) {
this._nameCoordMap = source.nameCoordMap;
this._regionsMap = source.nameCoordMap;
this._invertLongitute = invertLongitute == null ? true : invertLongitute;
/**
* @readOnly
......@@ -92,14 +94,11 @@ Geo.prototype = {
*/
transformTo: function (x, y, width, height) {
var rect = this.getBoundingRect();
// FIXME
// Should not name it as invertLng.
var invertLng = this.invertLng;
var invertLongitute = this._invertLongitute;
rect = rect.clone();
if (invertLng) {
if (invertLongitute) {
// Longitute is inverted
rect.y = -rect.y - rect.height;
}
......@@ -112,7 +111,7 @@ Geo.prototype = {
rawTransformable.decomposeTransform();
if (invertLng) {
if (invertLongitute) {
var scale = rawTransformable.scale;
scale[1] = -scale[1];
}
......
......@@ -134,29 +134,28 @@ var geoCreator = {
// FIXME Create each time may be slow
ecModel.eachComponent('geo', function (geoModel, idx) {
var name = geoModel.get('map');
var geo = new Geo(name + idx, name, geoModel.get('nameMap'));
geo.zoomLimit = geoModel.get('scaleLimit');
geoList.push(geo);
setGeoCoords(geo, geoModel);
geoModel.coordinateSystem = geo;
geo.model = geoModel;
// FIXME ???
var aspectScale = geoModel.get('aspectScale');
var invertLng = true;
var invertLongitute = true;
var mapRecords = mapDataStorage.retrieveMap(name);
if (mapRecords && mapRecords[0] && mapRecords[0].type === 'svg') {
aspectScale == null && (aspectScale = 1);
invertLng = false;
invertLongitute = false;
}
else {
aspectScale == null && (aspectScale = 0.75);
}
var geo = new Geo(name + idx, name, geoModel.get('nameMap'), invertLongitute);
geo.aspectScale = aspectScale;
geo.invertLng = invertLng;
geo.zoomLimit = geoModel.get('scaleLimit');
geoList.push(geo);
setGeoCoords(geo, geoModel);
geoModel.coordinateSystem = geo;
geo.model = geoModel;
// Inject resize method
geo.resize = resizeGeo;
......@@ -196,6 +195,7 @@ var geoCreator = {
// Inject resize method
geo.resize = resizeGeo;
geo.aspectScale = mapSeries[0].get('aspectScale');
geo.resize(mapSeries[0], api);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册