MapAppDev

description: 鎻愪緵2D銆?D鐨勫湴鍥炬湇鍔★細鍖呮嫭鍦扮悆灏哄害鐨勮櫄鎷熷湡鍦扮殑娴忚銆佷拱鍗栥€佷氦鏄撱€佸熀浜嶮ap鐨勫箍鍛娿€佷釜浜哄湴鍥俱€佹悳绱㈢瓑绛

Contents:

Map app for Paraworld

Title Map app for Paraworld
Author(s) ParaEngine Map Team
Date 2008/1/24
File script/kids/3DMapSystemUI/Map/app_main.lua

Description

Get Tile By ID

more info, see code doc.
   Map3DSystem.App.Map.GetTileByID(tileID, callback, param1)

INSERT INTO apps VALUES (NULL, 'Map_GUID', 'Map', '1.0.0', 'http://www.paraengine.com/apps/Map_v1.zip', 'YourCompany', 'enUS', 'script/kids/3DMapSystemUI/Map/IP.xml', '', 'script/kids/3DMapSystemUI/Map/app_main.lua', 'Map3DSystem.App.Map.MSGProc', 1);

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Map/app_main.lua");

Member Functions

Map3DSystem.App.Map.OnConnection

requires

create class commonlib.setfield("Map3DSystem.App.Map", {});


event handlers

OnConnection method is the obvious point to place your UI (menus, mainbars, tool buttons) through which the user will communicate to the app. This method is also the place to put your validation code if you are licensing the add-in. You would normally do this before putting up the UI. If the user is not a valid user, you would not want to put the UI into the IDE.

  • param app : the object representing the current application in the IDE.
  • param connectMode : type of ConnectMode.

syntax

function Map3DSystem.App.Map.OnConnection(app, connectMode)

parameters

app the object representing the current application in the IDE.
connectMode  

Map3DSystem.App.Map.OnDisconnection

Receives notification that the Add-in is being unloaded.

syntax

function Map3DSystem.App.Map.OnDisconnection(app, disconnectMode)

parameters

app  
disconnectMode  

Map3DSystem.App.Map.OnQueryStatus

This is called when the command's availability is updated When the user clicks a command (menu or mainbar button), the QueryStatus event is fired. The QueryStatus event returns the current status of the specified named command, whether it is enabled, disabled, or hidden in the CommandStatus parameter, which is passed to the msg by reference (or returned in the event handler).

  • param commandName : The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".
  • param statusWanted : what status of the command is queried. it is of type CommandStatusWanted
  • return __ : returns according to statusWanted. it may return an integer by adding values in CommandStatus.

syntax

function Map3DSystem.App.Map.OnQueryStatus(app, commandName, statusWanted)

parameters

app  
commandName The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".
statusWanted  
return returns according to statusWanted. it may return an integer by adding values in CommandStatus.

Map3DSystem.App.Map.OnExec

This is called when the command is invoked.The Exec is fired after the QueryStatus event is fired, assuming that the return to the statusOption parameter of QueryStatus is supported and enabled. This is the event where you place the actual code for handling the response to the user click on the command.

  • param commandName : The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".

syntax

function Map3DSystem.App.Map.OnExec(app, commandName, params)

parameters

app  
commandName The name of the command to determine state for. Usually in the string format "Category.SubCate.Name".
params  

Map3DSystem.App.Map.OnRenderBox

Change and render the 3D world with mcml data that is usually retrieved from the current user's profile page for this application.

syntax

function Map3DSystem.App.Map.OnRenderBox(mcmlData)

parameters

mcmlData  

Map3DSystem.App.Map.Navigate

called when the user wants to nagivate to the 3D world location relavent to this application

syntax

function Map3DSystem.App.Map.Navigate()

Map3DSystem.App.Map.GotoHomepage

called when user clicks to check out the homepage of this application. Homepage usually includes: developer info, support, developer worlds information, app global news, app updates, all community user rating, active users, trade, currency transfer, etc.

syntax

function Map3DSystem.App.Map.GotoHomepage()

Map3DSystem.App.Map.DoQuickAction

called when user clicks the quick action for this application.

syntax

function Map3DSystem.App.Map.DoQuickAction()

Map3DSystem.App.Map.OnActivateDesktop

Add terrain, sky and ocean button to the toolbar.

syntax

function Map3DSystem.App.Map.OnActivateDesktop()

Map3DSystem.App.Map.OnDeactivateDesktop

syntax

function Map3DSystem.App.Map.OnDeactivateDesktop()

Map3DSystem.App.Map.MSGProc


client world database function helpers.


all related messages

APPS can be invoked in many ways: Through app Manager mainbar or menu command or buttons Command Line 3D World installed apps

syntax

function Map3DSystem.App.Map.MSGProc(window, msg)

parameters

window  
msg  

Map3DSystem.App.Map.GetTileByID

this is wrapper function of paraworld.map.GetTileByID

  • param tileID : tile id, or its string.
  • param callback : function of (tileInfo, param1)
  • param param1 : an optional parameter passed to callback. this can be nil.
  • return __ : it will return true it is fetching or already fetched.

syntax

function Map3DSystem.App.Map.GetTileByID(tileID, callback, param1)

parameters

tileID tile id, or its string.
callback  
param1 an optional parameter passed to callback. this can be nil.

Map3DSystem.App.Map.GetTileByIDCallBack

callback

syntax

function Map3DSystem.App.Map.GetTileByIDCallBack(msg,args)

parameters

msg  
args  

Member Functions

BuyRandomTileCmd.OnGetResult

private

syntax

function BuyRandomTileCmd.OnGetResult(self,tileID,isSuccess,errorCode)

parameters

self  
tileID  
isSuccess  
errorCode  

BuyRandomTileCmd:OnCmdDone

private

syntax

function BuyRandomTileCmd:OnCmdDone(tileID,isSuccess)

parameters

tileID  
isSuccess  

some helper function convert DB data type to run time data type

Title some helper function convert DB data type to run time data type
Author(s) Clayman
Date Desc:
File script/kids/3DMapSystemUI/Map/DataPvdHelper.lua

Description

TIP Sample Code

--NPL.load("(gl)script/kids/3DMapSystemUI/Map/DataPvdHelper.lua");

Member Functions

helper.ParseTexture

texture string format is something like: "*/*/../*.*; /*/../.*"

syntax

function helper.ParseTexture(textureString)

parameters

textureString  

helper.ParseTileInfo

convert data base tileInfo type to runtime type

syntax

function helper.ParseTileInfo(msg)

parameters

msg  

helper.ConvertModel2RunType

convert data base modelInfo to runtime type

syntax

function helper.ConvertModel2RunType(dbModelData)

parameters

dbModelData  

Member Functions

landCell:SetTileInfo

private

syntax

function landCell:SetTileInfo(tileInfo)

parameters

tileInfo  

landCell:UpdateTerrainPos

private,update terrain position

syntax

function landCell:UpdateTerrainPos()

landCell:UpdateModelPos

private,update model position

syntax

function landCell:UpdateModelPos()

landCell:UpdateMarkPos

private,update mark position

syntax

function landCell:UpdateMarkPos()

landCell:RefreshModels

private,create new models

syntax

function landCell:RefreshModels()

landCell:Clear

clear all models,marks,reset terrain to default state

syntax

function landCell:Clear()

landCell:ResetTerrain

private,reset terrain to default state

syntax

function landCell:ResetTerrain()

landCell:RemoveModels

private,clear all building models

syntax

function landCell:RemoveModels()

landCell:RemoveMarks

private,clear all marks on this tile

syntax

function landCell:RemoveMarks(bShow)

parameters

bShow  

landCell.OnReceiveTileInfo

data privder GetTileInfo() callback function

syntax

function landCell.OnReceiveTileInfo(receiver,tileInfo)

parameters

receiver  
tileInfo  

land generator

Title land generator
Author(s) SunLingFeng
Date 2008/1/25
File script/kids/3DMapSystemUI/Map/landGenerator.lua

Description

Member Functions

landGen.QueryTileType

private

syntax

function landGen.QueryTileType(norPosX,norPosY)

parameters

norPosX  
norPosY  

the map app entry point

Title the map app entry point
Author(s) SunLingFeng
Date 2008/1/10
File script/kids/3DMapSystemUI/Map/Map3DApp.lua

Description

Member Functions

MainWnd:new

======display model enum======= DisplayMode = {}; DisplayMode.normal = 0; DisplayMode.edit = 1;

======public===================

syntax

function MainWnd:new(o)

parameters

o  

MainWnd:CreateUI

==========private==============

syntax

function MainWnd:CreateUI()

SpriteAnimationPlayer

Title SpriteAnimationPlayer
Author(s) SunLingfeng @ paraengine.com
Date 2008/1/29
File script/kids/3DMapSystemUI/Map/Map3DAppAnimationPlayer.lua

Description

SpriteAnimationPlayer is a sprite sheet player,it receive a paraUIObject as target window, draw animation on it.SpriteAnimationPlayer assume the sprite sheet texture size is power of 2,eg,256*256,512*512. frameSize is the size of each frame in the texture.

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Map/Map3DAppAnimationPlayer.lua");
local cloudPlayer = Map3DApp.SpriteAnimationPlayer:new{
   name = self.cloudLayer,
   targetWndName = self.name,
   totalFrame = 16,
   defaultFrame = 1,
   frameSize = 256,
   spriteSheet = "model/map3D/texture/clouds.dds",
};
cloudLayer:Play(false,false)

Member Functions

SpriteAnimationPlayer:new

=========public===============

syntax

function SpriteAnimationPlayer:new(o)

parameters

o  

SpriteAnimationPlayer:Init

==============private============

syntax

function SpriteAnimationPlayer:Init()

Managing model and texture in map system.

Title Managing model and texture in map system.
Author(s) SunLingfeng @ paraengine.com
Date 2007/10/18
File script/kids/3DMapSystemUI/Map/Map3DAppAssetManager.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Map/Map3DAppAssetManager.lua");

Member Functions

Map3DApp.Global.AssetManager.Destroy

delete all resources.

syntax

function Map3DApp.Global.AssetManager.Destroy()

Map3DApp.Global.AssetManager.GetModel

return managed ParaAssetObject by file name

syntax

function Map3DApp.Global.AssetManager.GetModel(modelName)

parameters

modelName  

Map3DApp.Global.AssetManager.GetTexture

return managed ParaAssetObject by file name

syntax

function Map3DApp.Global.AssetManager.GetTexture(textureName)

parameters

textureName  

Map3DApp.Global.AssetManager.UnloadModel

unload a given asset by file name

syntax

function Map3DApp.Global.AssetManager.UnloadModel(modelName)

parameters

modelName  

Map3DApp.Global.AssetManager.UnloadTexture

unload a given asset by file name

syntax

function Map3DApp.Global.AssetManager.UnloadTexture(textureName)

parameters

textureName  

Map3DApp.Global.AssetManager.GetMapTex


syntax

function Map3DApp.Global.AssetManager.GetMapTex(textureName)

parameters

textureName  

Map3DApp.Global.AssetManager.GetCharacter

syntax

function Map3DApp.Global.AssetManager.GetCharacter(modelName)

parameters

modelName  

Member Functions

MapBBSBar:new

-----MapBBSBar
local MapBBSBar = {
   name = "rollingBar";
   parent = nil;
   
   --layout
   alignment = "_lt";
   left = 5;
   top = 0;
   width = 600;
   height = 24;
   
   --msg list,a circle queue
   maxMsgCount = 30;
   
   rollSpeed = 2;
   
   --private data
   billboards = {};
   billboardCount = 4;
   billboardSpace = 15;
   
   freeBillboards = nil;
   activeBillboards = nil;   
   
   font = nil;
   fontColorCount = 1;
   fontHighLight = "130 30 130";
   
   timerID;
   rollingState = Map3DApp.RollState.stop;
   lastRollingState = Map3DApp.RollState.stop;
   
   selectItem = nil;
   
   --event
   onItemSelect = nil;
   onMsgPop = nil;
   onMsgEmpty = nil;
}
MapBBSBar = MapBBSBar;

public

syntax

function MapBBSBar:new(o)

parameters

o  

MapBBSBar:Destroy

public

syntax

function MapBBSBar:Destroy()

MapBBSBar:Show

public

syntax

function MapBBSBar:Show(bShow)

parameters

bShow  

MapBBSBar:Init

private function, once called once on oject creation

syntax

function MapBBSBar:Init()

MapBBSBar:ResetUI

private function,reset all ui related object call this method after sence reset

syntax

function MapBBSBar:ResetUI()

MapBBSBar.OnMouseEnter

private method,stop rolling when mouse enter a billboard

syntax

function MapBBSBar.OnMouseEnter(ctrName,index)

parameters

ctrName  
index  

MapBBSBar.OnMouseLeave

private,resume rolling state when mouse leave billboard

syntax

function MapBBSBar.OnMouseLeave(ctrName,index)

parameters

ctrName  
index  

MapBBSBar.OnMouseUp

private,fired when click on a billboard

syntax

function MapBBSBar.OnMouseUp(ctrName)

parameters

ctrName  

MapBBSBar:ActiveRolling

private,AddMessage will automatic call this method to roll when new message come

syntax

function MapBBSBar:ActiveRolling()

MapBBSBar:Update

private,update display

syntax

function MapBBSBar:Update()

MapBBSBar:RefreshBillboard

private

syntax

function MapBBSBar:RefreshBillboard()

MapBBSBar:Rolling

private move the position of each billboard

syntax

function MapBBSBar:Rolling()

MapBBSBar:SetParent

public

syntax

function MapBBSBar:SetParent(_parent)

parameters

parent  

MapBBSBar:SetPosition

public

syntax

function MapBBSBar:SetPosition(x,y,width,height)

parameters

x  
y  
width  
height  

MapBBSBar:AddMessage

public

syntax

function MapBBSBar:AddMessage(newMsg)

parameters

newMsg  

MapBBSBar:PopMessage

public

syntax

function MapBBSBar:PopMessage()

MapBBSBar:Pause

public

syntax

function MapBBSBar:Pause()

MapBBSBar:Resume

public

syntax

function MapBBSBar:Resume()

MapBBSBar:IsMsgFull

public

syntax

function MapBBSBar:IsMsgFull()

MapBBSBar:SetFontColor

public

syntax

function MapBBSBar:SetFontColor(color,colorIndex)

parameters

color  
colorIndex  

Member Functions

MapBBSMsgEdit:new

------------------------------------
-----------MapBBSMsgEdit--------
------------------------------------
local MapBBSMsgEdit = {
   name = "bbsMsgBox",
   parent = nil,
   
   alignment = "_lt",
   x = 100,
   y = 100,
   width = 450,
   height = 60,
   textBox = nil;
   onMsgSend = nil;
}
MapBBSMsgEdit = MapBBSMsgEdit;

syntax

function MapBBSMsgEdit:new(o)

parameters

o  

MapBBSMsgViewer:new

-------------------------------------------------
------------MapBBSMsgViewer------------
-------------------------------------------------
local MapBBSMsgViewer = {
   name = nil;
   parent = nil;
   
   alignment = "_lt",
   x = 0,
   y = 0,
   width = 500,
   height = 300,
   
   --event
   onItemSelect = nil;
   onShow = nil;
}
MapBBSMsgViewer = MapBBSMsgViewer;

syntax

function MapBBSMsgViewer:new(o)

parameters

o  

MapBBSMsgViewer.OnItemSelect

private,fire onMsgSelect event

syntax

function MapBBSMsgViewer.OnItemSelect(ctrName)

parameters

ctrName  

Member Functions

Map3DApp.Timer.GetNewTimerID

Default Font DefaultFont = "System";


timer id creator------------------------------ all timer id used in 3d map was created by this class
Map3DApp.Timer = {}; Map3DApp.Timer.minTimerID = 200; Map3DApp.Timer.maxTimerID = Map3DApp.Timer.minTimerID - 1;

syntax

function Map3DApp.Timer.GetNewTimerID()

Queue:new

-----------------------------
----------Queue--------------
local Queue = {
   list = {};
   firstElement =1;
   lastElement = 0;
   elementCount = 0;
   maxElementCount = 0;
}

Map3DApp.Queue = Queue;

syntax

function Queue:new(o)

parameters

o  

Queue:Peek

Returns the object at the beginning of the Queue without removing it

syntax

function Queue:Peek()

CycleQueue:new

-----------------

local CycleQueue = {
   --only set this value at init time
   maxElementCount = 0;
   --thers are all private data
   list = {};
   firstElement=1;
   lastElement=0;
   elementCount = 0;
}
CycleQueue = CycleQueue;

syntax

function CycleQueue:new(o)

parameters

o  

Map data provider

Title Map data provider
Author(s) SunLingFeng
Date 2008/1/25
File script/kids/3DMapSystemUI/Map/Map3DAppDataPvd.lua

Description

Member Functions

Map3DApp.DataPvd.SetServerURL

set remote server url

syntax

function Map3DApp.DataPvd.SetServerURL(url)

parameters

url  

Map3DApp.DataPvd.GetTotalCellCount

total map cell count DataPvd.totalCellCount = 32768; DataPvd.logicCellSize = 1/32768;

syntax

function Map3DApp.DataPvd.GetTotalCellCount()

Map3DApp.DataPvd.GetTileByPos



tile
client call this method to get tile data sender is this client object callback data privde will call this function when data is prepared

syntax

function Map3DApp.DataPvd.GetTileByPos(posX,posY,objSender,callbackFun)

parameters

posX  
posY  
objSender  
callbackFun  

Map3DApp.DataPvd.BuytTile

buy tile with given id or position

  • params tileID :tile id you want to buy,can be nil
  • params x :,y:tile position you want to buy,can be nil
  • params terrainType :, can be nil
  • params __ :terrain texture,can be nil
  • params __ :callback function when remote call return

syntax

function Map3DApp.DataPvd.BuytTile(userSession,tileID,_x,_y,_terrainType,_texture,sender,callback)

parameters

userSession  
tileID tile id you want to buy,can be nil
x  
y  
terrainType , can be nil
texture  
sender  
callback  

Map3DApp.DataPvd.MockGetTilesInRegion

mock RPC for testing

syntax

function Map3DApp.DataPvd.MockGetTilesInRegion(msg,args)

parameters

msg  
args  

Map3DApp.DataPvd.GetRandomTilePosInRegion

get a random tile in reagion

  • params x :center point x in normalized world coordinate
  • params y :center point y in normalized world coordinate
  • params radius :region width,in normalized world coordinate

syntax

function Map3DApp.DataPvd.GetRandomTilePosInRegion(x,y,radius)

parameters

x center point x in normalized world coordinate
y  
radius region width,in normalized world coordinate

Map3DApp.DataPvd.GetWorldByID


world

syntax

function Map3DApp.DataPvd.GetWorldByID(id,sender,callback)

parameters

id  
sender  
callback  

Map3DApp.DataPvd.GetLandTexByID


land texture

syntax

function Map3DApp.DataPvd.GetLandTexByID(id)

parameters

id  

Map3DApp.DataPvd.GetModelByID



for model
DataPvd.pageCount = 0; DataPvd.modelCount = 0; DataPvd.modelList = {}; DataPvd.modelIDMappingList = {};

public

syntax

function Map3DApp.DataPvd.GetModelByID(modelID)

parameters

modelID  

Map3DApp.DataPvd.GetModelOfPage

result is type of modelInfo[]

syntax

function Map3DApp.DataPvd.GetModelOfPage(pageNum,pageIndex)

parameters

pageNum  
pageIndex  

Map3DApp.DataPvd.Get3DMark



3d mark manipulation

syntax

function Map3DApp.DataPvd.Get3DMark(markID)

parameters

markID  

Map3DApp.DataPvd.UpdataMCMLMap



2d mark manipulation
create or updata a mcml map

syntax

function Map3DApp.DataPvd.UpdataMCMLMap(map)

parameters

map  

Map3DApp.DataPvd.DeleteMCMLMap

deleta a MCML map

syntax

function Map3DApp.DataPvd.DeleteMCMLMap(mapName)

parameters

mapName  

Map3DApp.DataPvd.GetMap

================2d map texture================== MapTexture = {}; MapTexture.root = "Texture/worldMap"; MapTexture.files = {}; MapTexture.fileFmt = "jpg"; MapTexture.textures = {}; MapTexture.defaultTexture = "Texture/whitedot.png";

return 2D map texture

syntax

function Map3DApp.DataPvd.GetMap(x,y,level)

parameters

x  
y  
level  

Map3DApp.DataPvd.GetMapTileModelID


Helper

DataPvd.mapTileModel = 0;

syntax

function Map3DApp.DataPvd.GetMapTileModelID()

Member Functions

Map:new

==========public==============

syntax

function Map:new(o)

parameters

o  

Map:SetEnable

if allow use to drag and zoom the map

  • params isEnable :bool

syntax

function Map:SetEnable(isEnable)

parameters

isEnable bool

Map:JumpTo3D

jump to a point on 3D map

syntax

function Map:JumpTo3D(x,y)

parameters

x  
y  

Map:SetViewPosition

center map to (x,y)

  • params x :in normalized world coordinate
  • params y :in normalized world coordinate

syntax

function Map:SetViewPosition(x,y)

parameters

x in normalized world coordinate
y  

Map:SetZoomValue

zoom map,

  • params value :rang in [0,1]

syntax

function Map:SetZoomValue(value)

parameters

value rang in [0,1]

Map:SetDisplayState

set map display mode 2D or 3D

  • params displayState :Map3DApp.WorldMap.DisplayState enum

syntax

function Map:SetDisplayState(displayState)

parameters

displayState DisplayState enum

Map:SetWndPosition

set window position

syntax

function Map:SetWndPosition(x,y)

parameters

x  
y  

Map:SetWndSize

set window size

syntax

function Map:SetWndSize(width,height)

parameters

width  
height  

Map:GetWndPosition

get window top left point positio and window width,height

syntax

function Map:GetWndPosition()

Map:GetDisplayMode

get current displayer mode

syntax

function Map:GetDisplayMode()

Map:GetViewParams

get view parameters

syntax

function Map:GetViewParams()

Map:GetWnd

return the map window container allow other object draw extra element on this map

syntax

function Map:GetWnd()

Map:SetParentWnd

set parent control

syntax

function Map:SetParentWnd(parentWnd)

parameters

parentWnd  

Map:MousePick

do mouse pick

syntax

function Map:MousePick()

Map:FireViewRegionChange

fire view region changed event

syntax

function Map:FireViewRegionChange()

Map:SendMessage

==========private===============

syntax

function Map:SendMessage(msg)

parameters

msg  

Map:CreateUI

Create ui controls

syntax

function Map:CreateUI()

a simple control to show model information,include model name,description,price,manufacturer and so on.

Title a simple control to show model information,include model name,description,price,manufacturer and so on.
Author(s) Sun Lingfeng
Date 2008/1/21
File script/kids/3DMapSystemUI/Map/Map3DAppModelInfoWnd.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Map/Map3DAppModelInfoWnd.lua");
_this = Map3DApp.ModelInfoWnd:new{
   name ="modelInfoWnd",
   alignment = "_lt",
   left = 0,
   top = 0,
   parent = _parent;
}
_this:Show(true);

Member Functions

Map3DApp.TileEditScene.Release

layout TileEditScene.alignment = "_fi"; TileEditScene.left = 2; TileEditScene.top = 2; TileEditScene.width = 2; TileEditScene.height =2; TileEditScene.parent = nil;

render targe size TileEditScene.resolutionX = 512; TileEditScene.resolutionY = 512;

TileEditScene.scene = nil; TileEditScene.tileSize = 4; TileEditScene.timerID = GetNewTimerID();

TileEditScene.activeModel = nil; TileEditScene.activeCmd = nil; TileEditScene.modelData = nil; TileEditScene.editState=0;

mouse state TileEditScene.isLMBDown = false; TileEditScene.isRMBDown = false; TileEditScene.lastMousePosX = 0; TileEditScene.lastMousePosY = 0; TileEditScene.mouseDownPosX = 0; TileEditScene.mouseDownPosY = 0;

camera parameters TileEditScene.maxZoomValue = 15; TileEditScene.minZoomValue = 5; TileEditScene.zoomValue = 1; TileEditScene.minPitch = 0.4; TileEditScene.maxPitch = 1.57; TileEditScene.pitchValue = 0.5; TileEditScene.rotateValue = 0; TileEditScene.defaultRotate = 0;

TileEditScene.Camera = {}; TileEditScene.Camera.fov = math.pi/6; TileEditScene.Camera.nearPlane = 0.5; TileEditScene.Camera.farPlane = 150; TileEditScene.Camera.aspectRatio = 1;

release all resource

syntax

function Map3DApp.TileEditScene.Release()

Map3DApp.TileEditScene.Show

show the tile edit scene

syntax

function Map3DApp.TileEditScene.Show(bShow)

parameters

bShow  

Map3DApp.TileEditScene.SetParent

set parent control

syntax

function  Map3DApp.TileEditScene.SetParent(pWnd)

parameters

pWnd  

Map3DApp.TileEditScene.Zoom

zoom camera,zoomValue is in range[0,1],0 is max zoom;

syntax

function Map3DApp.TileEditScene.Zoom(zoomValue)

parameters

zoomValue  

Map3DApp.TileEditScene.Pitch

pitch camera

syntax

function Map3DApp.TileEditScene.Pitch(pitchValue)

parameters

pitchValue  

Map3DApp.TileEditScene.AddModel

add new model to scene

syntax

function Map3DApp.TileEditScene.AddModel(modelName,modelData)

parameters

modelName  
modelData  

Map3DApp.TileEditScene.SetModelPosition

set model position by model ID

syntax

function Map3DApp.TileEditScene.SetModelPosition(modelID,x,y,z)

parameters

modelID  
x  
y  
z  

Map3DApp.TileEditScene.SetModelFacing

set model facing by ID

syntax

function Map3DApp.TileEditScene.SetModelFacing(modelID,facing)

parameters

modelID  
facing  

Map3DApp.TileEditScene.ShowModel

show the model by ID

syntax

function Map3DApp.TileEditScene.ShowModel(modelID,bShow)

parameters

modelID  
bShow  

Map3DApp.TileEditScene.RemoveModel

remove model

syntax

function Map3DApp.TileEditScene.RemoveModel(modelName)

parameters

modelName  

Map3DApp.TileEditScene.ClearAllModel

clear all model in scene

syntax

function Map3DApp.TileEditScene.ClearAllModel()

Map3DApp.TileEditScene.GetModelPosition

get model position,the reture model position is in range[-1,1]

syntax

function Map3DApp.TileEditScene.GetModelPosition(modelName)

parameters

modelName  

Map3DApp.TileEditScene.SetActiveModel

set current active model

syntax

function Map3DApp.TileEditScene.SetActiveModel(modelName)

parameters

modelName  

Map3DApp.TileEditScene.SetMsgCallback

set tile edit scene message handle

syntax

function Map3DApp.TileEditScene.SetMsgCallback(callback)

parameters

callback  

Map3DApp.TileEditScene.SetCommand

set a command object

syntax

function Map3DApp.TileEditScene.SetCommand(cmd)

parameters

cmd  

Map3DApp.TileEditScene.CreateUI

===========private method=================

syntax

function Map3DApp.TileEditScene.CreateUI()

Map3DApp.TileEditScene.OnMouseDown

========mouse event handler==============

syntax

function Map3DApp.TileEditScene.OnMouseDown()

camera of the map system for both the 2D and 3D

Title camera of the map system for both the 2D and 3D
Author(s) SunLingFeng
Date 2007/10/10
File script/kids/3DMapSystemUI/Map/Map3DAppVirtualCamera.lua

Description

Exposes the main map window to app_main.lua of the map application.

Title Exposes the main map window to app_main.lua of the map application.
Author(s) Date: 2008/1/24
Date 2008/1/24
File script/kids/3DMapSystemUI/Map/Map3DAppWrapper.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Map/Map3DAppWrapper.lua");
Map3DSystem.App.Map.ShowMapWnd(app);
Map3DSystem.App.Map.MapWnd.Show(bShow,_parent,parentWindow)

Member Functions

Map3DSystem.App.Map.ShowMapWnd

create class commonlib.setfield("Map3DSystem.App.Map.MapWnd", {});

the map application's container name. MapWnd.name = "map3D";

display the main map window

  • param __ :_app: the map app window object.

syntax

function Map3DSystem.App.Map.ShowMapWnd(_app)

parameters

app  

Map3DSystem.App.Map.MapWnd.Show

  • param bShow : boolean to show or hide. if nil, it will toggle current setting.
  • param __ :_parent: parent window inside which the content is displayed. it can be nil.

syntax

function Map3DSystem.App.Map.MapWnd.Show(bShow,_parent,parentWindow)

parameters

bShow boolean to show or hide. if nil, it will toggle current setting.
parent  
parentWindow  

Map3DSystem.App.Map.MapWnd.OnClose

Send WM_CLOSE message to the map window.

syntax

function Map3DSystem.App.Map.MapWnd.OnClose()

Map3DSystem.App.Map.MapWnd.Test

TODO: remove this at release time.

syntax

function Map3DSystem.App.Map.MapWnd.Test()

display 2D map

Title display 2D map
Author(s) SunLingFeng
Date 2007/1/20
File script/kids/3DMapSystemUI/Map/Map3D_2DMap.lua

Description

Member Functions

Map2DLayer:Init

create 2D map object

syntax

function Map2DLayer:Init()

Map2DLayer:OnSceneReset

create scene and model

syntax

function Map2DLayer:OnSceneReset()

Map2DLayer:ResetViewRegion

set view region to default value

syntax

function Map2DLayer:ResetViewRegion()

Map2DLayer:SetViewElevation

set zoom value

syntax

function Map2DLayer:SetViewElevation(elevation)

parameters

elevation  

Map2DLayer:UpdateView

update tile position and texture

syntax

function Map2DLayer:UpdateView()

Map2DLayer:GetCurrentMapResolution

get the current 2D map Resolution

syntax

function Map2DLayer:GetCurrentMapResolution()

Map2DLayer:GetViewParams

get current view params,including center point of view region zoom value and view region width

syntax

function Map2DLayer:GetViewParams()

display 3D map

Title display 3D map
Author(s) Sun Lingfeng
Date 2007/1/20
File script/kids/3DMapSystemUI/Map/Map3D_3DMap.lua

Description

Member Functions

Map3DLayer:Destory

Destory object

syntax

function Map3DLayer:Destory()

Map3DLayer:ResetScene

private,recreate scene after scene reset

syntax

function Map3DLayer:ResetScene()

Map3DLayer:SetResolution

set render target size

syntax

function Map3DLayer:SetResolution(width,height)

parameters

width  
height  

Map3DLayer:Init

delete this

only call Init once

syntax

function Map3DLayer:Init()

Map Browser Frame

Title Map Browser Frame
Author(s) Sun Lingfeng
Date Use the lib:
File script/kids/3DMapSystemUI/Map/MapBrowserFrame.lua

Description

Member Functions

Map3DApp.MapBrowserFrame.Show

child control MapBrowserFrame.uiSideBar = "mb_sideBarCtn"; MapBrowserFrame.uiMap = "mb_mapCtn"; MapBrowserFrame.uiSplit = "mb_split"; MapBrowserFrame.ctrMap = "mb_map"; MapBrowserFrame.ctrSideBar = "mb_sideBar";

MapBrowserFrame.uiController = nil;

MapBrowserFrame.bShowSideBar = true;

syntax

function Map3DApp.MapBrowserFrame.Show(bShow)

parameters

bShow  

Map3DApp.MapBrowserFrame.SetParentForm

set the root control name

syntax

function Map3DApp.MapBrowserFrame.SetParentForm(parentForm)

parameters

parentForm  

Map3DApp.MapBrowserFrame:Init


=================================

syntax

function Map3DApp.MapBrowserFrame:Init()

Member Functions

SideBar:Init


==========private=================

syntax

function SideBar:Init()

Member Functions

tileInfo:new

tileInfo
local tileInfo = {
   --object id
   id = 0,
   name = nil,
   
   x = 0,
   y = 0,
   z = 0,
   shape = 0,
   terrainInfo = nil, --terrainInfo
   models = nil, --modelInstance array
   
   --logicTileInfo
   ownerUserID = nil,
   ownerUserName = nil,
   tileState = 5,
   price = 0,
   price2 = 0,
   price2StartTime = nil,
   price2EndTime = nil,
   rentPrice = 0,
   rank = 0,
   cityName = nil,
   allowEdit = false,
   userUserID = nil,
   userName = nil,
   rentEndDate = nil,
   image = nil,
   community = nil,
   ageGroup = nil, 
   worldID = 0,
   worldName = nil,
}
TileInfo = tileInfo;

syntax

function tileInfo:new(o)

parameters

o  

tileInfo:Reset

reset tileInfo to default value

syntax

function tileInfo:Reset()

tileInfo.CreateTileInfo

tileInfo pool tileInfo.pool = {}; tileInfo.count = 0; tileInfo.first = 0; tileInfo.last = 0;

syntax

function tileInfo.CreateTileInfo()

terrainInfo:new

----create a tileInfo container there
Map3DApp.TileInfo.tileInfos = {};

--function Map3DApp.TileInfo.GetTileInfo(id)
   --return Map3DApp.TileInfo.tileInfos[id];
end

--function Map3DApp.TileInfo.AddTileInfo(id,tileInfo)
   --Map3DApp.TileInfo.tileInfos[id] = tileInfo;
end

--function Map3DApp.TileInfo.RemoveTileInfo(id)
   --if(Map3DApp.TileInfo.tileInfos[id])then
      --Map3DApp.TileInfo.tileInfos[id] = nil;
   --end
end


terrainInfo
local terrainInfo = {
   type = 1,
   textureID0 = 0,
   texture0 = nil,
   textureID1 = nil,
   texture1 = nil,
   rotation = 0,
}
; TerrainInfo = terrainInfo;

syntax

function terrainInfo:new(o)

parameters

o  

modelInfo:new

modelInfo
local modelInfo = {
   --object id
   id = 0,
   name = "mm_0_0", --mm means map model
   --geometry data
   model = nil,
   image = nil,
   tex0 = nil,   
   tex1 = nil,
   type = 1,
   --x = 0,
   --y = 0,
   --facing = 0,
   --logic data
   manufacturerType = 0,
   manufacturerID = "1",
   manufacturerName = "ParaEngine",
   price = 0,
   price2 = 0,
   price2StartTime = "00-00-00",
   price2EndTime = "00-00-00",
   AddDate = "00-00-00",
   --OwnerUserID = nil,
   --OwnerUserName = nil,
   version = nil,
}
ModelInfo = modelInfo;

syntax

function modelInfo:new(o)

parameters

o  

world:new

------------------------------
world
------------------------------
local world = {
   id = 0,
   name = "",
   desc = "",
   version = nil,
   ownerID = 0,
   ownerName = "",
   spaceServer = nil,
   jabberGSL = nil,
   GSL = nil,
   gameServer = nil,
   visits = 0,
   rank = 1,
   ageGroup = 4,
   gameData = nil,
}
Map3DApp.World = world;

syntax

function world:new(o)

parameters

o  

modelInstance:new



model instance--------
local modelInstance = { id = 0, modelID = 0, model = nil, texture = nil, facing = 0, offsetX = 0, offsetY = 0, } ModelInstance = modelInstance;

syntax

function modelInstance:new(o)

parameters

o  

modelInstance.CreateModelInst

model instance pool modelInstance.pool = {}; modelInstance.count = 0; modelInstance.first = 0; modelInstance.last = 0;

syntax

function modelInstance.CreateModelInst()

mark3DInfo:new

-------------------------------
----mark3DInfo
-------------------------------
local mark3DInfo = {
   id = 0,
   markStyle = 1,
   type = 0,
   x,
   y,
   
   markTitle = "pe",
   cityName = "city of rock",
   rank = 0,
   startTime = "00-00-00",
   endTime = "00-00-00",
   image = nil,
   signature = nil,
   desc = nil,
   ageGroup = 0,
   isApproved = false,
   version = nil,
   ownerUserID = nil,
   clickCnt = 0,
   worldID = 0,
   allowEdit = nil,   
}
Mark3DInfo = mark3DInfo;

syntax

function mark3DInfo:new(o)

parameters

o  

render group models of a tile

Title render group models of a tile
Author(s) Sun Lingfeng
Date 2008/4/9
File script/kids/3DMapSystemUI/Map/MapModelGroup.lua

Description

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemApp/API/MapModelGroup.lua");
local modelGroup = Map3DApp.ModelGroup:new{
   id = "modelgp",
};

Member Functions

ModelGroup:RemoveModels

remove all models

syntax

function ModelGroup:RemoveModels()

ModelGroup:SetModelData

call RefreshDisplay after SetModelData to show new models

syntax

function ModelGroup:SetModelData(modelInstances)   

parameters

modelInstances  

ModelGroup:SetScale

set model scale value

syntax

function ModelGroup:SetScale(scale)

parameters

scale  

ModelGroup:CreateModels

========private============

syntax

function ModelGroup:CreateModels()

Map registration page

Title Map registration page
Author(s) LiXizhi
Date 2008/3/21
File script/kids/3DMapSystemUI/Map/MapRegPage.lua

Description

Ask the user to pick a home land.

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Map/MapRegPage.lua");
Map3DSystem.App.Map.MapRegPage:Create("Map.MapRegPage", parent, "_fi", 0,0,0,0);

Member Functions

MapRegPage.OnSelect

create class local MapRegPage = Map3DSystem.mcml.PageCtrl:new({url="script/kids/3DMapSystemUI/Map/MapRegPage.html"}); MapRegPage = MapRegPage;

function to be called when user completed or skipped all app registration steps. callback function to call after the registration page finish or skip OnFinishedFunc = nil; MapRegPage.selectCity = nil;

called when user select to live in a city

syntax

function MapRegPage.OnSelect(btnName, values, bindingContext)

parameters

btnName  
values  
bindingContext  

MapRegPage.OnSkip

Skip the registration page

syntax

function MapRegPage.OnSkip(btnName, values, bindingContext)

parameters

btnName  
values  
bindingContext  

MapRegPage.OnAccept

Accept the current

syntax

function MapRegPage.OnAccept(btnName, values, bindingContext)

parameters

btnName  
values  
bindingContext  

MapRegPage.Leave

close this step.

syntax

function MapRegPage.Leave()

Member Functions

MBController:OnItemSelectInMap

===========private=================

syntax

function MBController:OnItemSelectInMap(mapName)

parameters

mapName  

code behind page for pe_land.html

Title code behind page for pe_land.html
Author(s) Clayman
Date 2008/6/12
File script/kids/3DMapSystemUI/Map/pe_land.lua

Description

show land information

TIP Sample Code

NPL.load("(gl)script/kids/3DMapSystemUI/Map/pe_land.lua");

-- you can specify which land to show with tileID
script/kids/3DMapSystemUI/Map/pe_land.html?tileID=405

pe_land 

Member Functions

landPage.SetData

private this function will be invoked when tileInfo returnd fromweb service

syntax

function landPage.SetData(pageInst,tileInfo)

parameters

pageInst  
tileInfo  

landPage.SetWorldData

this fucntion will be invoked when world data returnd from web service

syntax

function landPage.SetWorldData(pageInst,worldInfo)

parameters

pageInst  
worldInfo  

Member Functions

SideBarLandWnd:Init

================private==========================

syntax

function SideBarLandWnd:Init()

Map3DApp.SideBarLandWnd.MockGetTileInfos

===================================================

syntax

function Map3DApp.SideBarLandWnd.MockGetTileInfos()

Member Functions

SideBarSearchWnd:Init

============private===================

syntax

function SideBarSearchWnd:Init()

SideBarSearchWnd.OnResize

TODO:implement this function

syntax

function SideBarSearchWnd.OnResize()

Map3DApp.SideBarSearchWnd.GetCommendWorld

==========mock data source for testing============== delete these function

syntax

function Map3DApp.SideBarSearchWnd.GetCommendWorld()

Author(s): SunLingFeng

Title Author(s): SunLingFeng
Author(s) SunLingFeng
Date 2008/4/7
File script/kids/3DMapSystemUI/Map/TerrainTile.lua

Description

Member Functions

TerrainTile:Destory

destory object

syntax

function TerrainTile:Destory()

TerrainTile:RefreshDisplay

update terrain display

syntax

function TerrainTile:RefreshDisplay()

TerrainTile:Reset

reset terrain to initial state

syntax

function TerrainTile:Reset()

TerrainTile:CreateTerrain

=======private method============

syntax

function TerrainTile:CreateTerrain()

Member Functions

Map3DApp.Commands.IDGenerator.GetNewID

====================================== Map3DApp.Commands.IDGenerator = {}; Map3DApp.Commands.IDGenerator.id = 1; Map3DApp.Commands.tileEditor = nil;

syntax

function Map3DApp.Commands.IDGenerator.GetNewID()

AddModel:new

-------------------------------------------------
===========add model command===================
-------------------------------------------------
local AddModel = {
   cmdID = 0,
   
   modelID = 0,
   modelData = nil,
   
   sceneEditor = nil,
   editManager = nil,
}
AddModelCmd = AddModel;

syntax

function AddModel:new(o)

parameters

o  

MoveModelCmd:new

---------------------------------------------------------
============change model position command===============
change model position
local MoveModelCmd = {
   cmdID = 0,
   modelID = 0,
   
   newPosX = 0,
   newPosY = 0,
   oldPosX = 0,
   oldPosY = 0,
   
   sceneEditor = nil,
   editManager = nil,
}
MoveModelCmd = MoveModelCmd

syntax

function MoveModelCmd:new(o)

parameters

o  

ChangeModelFacing:new

=============change model facing command=================
local ChangeModelFacing = {
   cmdID = 0,
   modelID = 0,
   
   newFacing = 0,
   oldFacing = 0,
   
   sceneEditor = nil,
   editManager = nil,
}
ChangeModelFacingCmd = ChangeModelFacing;

syntax

function ChangeModelFacing:new(o)

parameters

o  

DeleteModel:new

=================delete model command====================
local DeleteModel = {
   cmdID = 0,
   modelID = 0,
   modelData = nil,
   sceneEditor = nil,
   eidtManager = nil,
}
DeleteModelCmd = DeleteModel

syntax

function DeleteModel:new(o)

parameters

o  

Map tile edit command holder

Title Map tile edit command holder
Author(s) SunLingFeng
Date 2008/3/18
File script/kids/3DMapSystemUI/Map/tileEditCmdHolder.lua

Description

Member Functions

Map3DApp.TileEditManager.GetNewModelID

===========public=======================

syntax

function Map3DApp.TileEditManager.GetNewModelID()

Map3DApp.TileEditManager.Reset

release all resource

syntax

function Map3DApp.TileEditManager.Reset()

Map3DApp.TileEditManager.SendMessage

==============private===================

syntax

function Map3DApp.TileEditManager.SendMessage(msg,data)

parameters

msg  
data  

Member Functions

tileEditor:ChooseModel

public,prepare to add a model

syntax

function tileEditor:ChooseModel()

Member Functions

TileEditWnd.OnMyLandsBtn

UI event

syntax

function TileEditWnd.OnMyLandsBtn()

TileEditWnd.OnControlLoad

logic

syntax

function TileEditWnd.OnControlLoad()

Edit/view folder dialog box

Title Edit/view folder dialog box
Author(s) LiXizhi, Leio zhang, refactored by LiXizhi 2008.2.11
Date 2008/1/22
File script/kids/3DMapSystemUI/Map/SideBar/DlgFolder.lua

Description

Member Functions

Map3DApp.DlgFolder.OnDlgResult

called when dialog returns.

syntax

function Map3DApp.DlgFolder.OnDlgResult(dialogResult)

parameters

dialogResult  

Map3DApp.DlgFolder.CreateDlg

create the dialog box content

syntax

function Map3DApp.DlgFolder.CreateDlg(_parent)

parameters

parent  

Edit/view mark dialog box

Title Edit/view mark dialog box
Author(s) LiXizhi, Leio zhang, refactored by LiXizhi 2008.2.11
Date 2008/1/22
File script/kids/3DMapSystemUI/Map/SideBar/DlgMark.lua

Description

Member Functions

Map3DApp.DlgMark.AttWrapper

writing/reading value from/to datasource for each indirect attribute of markNode.

syntax

function Map3DApp.DlgMark.AttWrapper(dataMember, bIsWriting, value)

parameters

dataMember  
bIsWriting  
value  

Map3DApp.DlgMark.CreateDlg

create the dialog box content

syntax

function Map3DApp.DlgMark.CreateDlg(_parent)

parameters

parent  

Edit/view Tile dialog box

Title Edit/view Tile dialog box
Author(s) Leio zhang
Date 2008/2/22
File script/kids/3DMapSystemUI/Map/SideBar/DlgTile.lua

Description

Author(s):Sun Lingfeng

Title Author(s):Sun Lingfeng
Author(s) Sun Lingfeng
Date 2008/2/22
File script/kids/3DMapSystemUI/Map/SideBar/GridView.lua

Description

Member Functions

ImageGridView:new

-------image grid view----------
local ImageGridView = {
   name = "igv",
   
   alignment = "_lt",
   left = 0,
   top = 0,
   width = 300,
   height = 300,
   
   parent = nil,
   
   cells = {},
   cellCount = 0,
   maxCellCount = 10,
   cellWidth = 0,
   cellHeight = 0,
   
   columnCount = 0,
   rowCount = 0,
   cellSpaceX = 4,
   cellSpaceY = 4,
   
   onCellClick = nil;
}
ImageGridView = ImageGridView;

syntax

function ImageGridView:new(o)

parameters

o  

ImageGridView:Reset

delete all cell data

syntax

function ImageGridView:Reset()

ImageGridView:SetData

dataSet is type of modelInfo

syntax

function ImageGridView:SetData(dataSet)

parameters

dataSet  

ImageGridView:AddCell

add new data to a cell

syntax

function ImageGridView:AddCell(image,data)

parameters

image  
data  

ImageGridView:IsFull

return true when all cell is occupied

syntax

function ImageGridView:IsFull()

ImageGridView:RecreateUI

===========private========================= create ui resource

syntax

function ImageGridView:RecreateUI()

ImageGridView.OnCellClick

syntax

function ImageGridView.OnCellClick(ctrName,cellID)

parameters

ctrName  
cellID  

Member Functions

markInfo:new

------------------------------------
 mark info
------------------------------------
 mark type
Map3DApp.MarkType = {
   player = 1,
   event = 2,
   city = 3,
   ad = 4,
}

 enumeration: button styles. 
Map3DApp.mark_styles={
   -- cursor_x, cursor_y is the cursor offset. 
   {icon = "Texture/3DMapSystem/common/Flag_red.png", cursor_x = 2, cursor_y = 17},
   {icon = "Texture/3DMapSystem/common/city.png", cursor_x = 8, cursor_y = 17},
   {icon = "Texture/3DMapSystem/common/Flag_green.png", cursor_x = 8, cursor_y = 17},
};

 enumeration: text styles. 
Map3DApp.mark_text_styles={
   {color = "0 0 0", scale=nil, background = "Texture/alphadot.png"},
   {color = "0 0 0", scale=1.2, background = "Texture/alphadot.png"},
   {color = "0 0 0", scale=0.9, background = "Texture/alphadot.png"},
   {color = "0 0 0", scale=1.3, background = "Texture/alphadot.png"},
};
   
local markInfo = {
   markID = nil,
   markType = 0,
   -- int, mark model or icon type: see MarkButton.button_style
   markStyle = 1,
   -- text style: see MarkButton.text_style
      bShowText = true,
      textColor = "0 0 0",
      textScale = 1,
      textRot = 0,
   markTitle = "鏈懡鍚?,
   markDesc = "",
   startTime = "",
   endTime = "",
   x = 0,
   y = 0,
   cityName = "",
   rank = 0,
   logo = "",
   signature = "",
   desc = "",
   ageGroup = 0,
   URL = "",
   isApproved = false,
   version = "",
   ownerUserID = "",
   clickCnt = 0,
   worldID = -1,
   allowEdit = false,
   z = 0,
}

Map3DApp.markInfo = markInfo;

syntax

function markInfo:new(o)

parameters

o  

markInfo:GetIcon

get the icon

syntax

function markInfo:GetIcon()

markInfo:GetCursorPt

get cursor point pixel position in the icon image.

  • return __ : defaults to 0,0

syntax

function markInfo:GetCursorPt()

parameters

return defaults to 0,0

folderInfo:new

------------------------------
 folder info
------------------------------
local folderInfo = {
   ID=nil,
   title="甯哥敤鏍囪",
   desc="",
}
Map3DApp.folderInfo = folderInfo;

syntax

function folderInfo:new(o)

parameters

o  

folderInfo:AddMark

add a new mark

  • param mark : if nil a new mark will be created.
  • return __ : return the mark added

syntax

function folderInfo:AddMark(mark)

parameters

mark if nil a new mark will be created.

folderInfo:RemoveMark

remove mark by ID

syntax

function folderInfo:RemoveMark(markID)

parameters

markID  

mapInfo:new

------------------------------
 map info
------------------------------
local mapInfo = {
   -- owner id or nil if local.
   userID = nil, 
}
Map3DApp.mapInfo = mapInfo;

syntax

function mapInfo:new(o)

parameters

o  

mapInfo:AddFolder

add folder from the map

  • param folder : if nil a new folder will be created.
  • return __ : return the folder added

syntax

function mapInfo:AddFolder(folder)

parameters

folder if nil a new folder will be created.

mapInfo:RemoveFolder

remove folder from the map

syntax

function mapInfo:RemoveFolder(ID)

parameters

ID  

mcml 2d map mark data provider

Title mcml 2d map mark data provider
Author(s) LiXizhi, Leio zhang, refactored by LiXizhi 2008.2.11
Date 2008/1/25
File script/kids/3DMapSystemUI/Map/SideBar/MarkProvider.lua

Description

Member Functions

Map3DApp.MarkProvider.Init

the map object for the local user. MyMapTree=nil; default name of the local my map file. it is always in the map app folder. MyMapFile="mymap.map";


my map related

call this to load my map from local disk.

syntax

function Map3DApp.MarkProvider.Init()

Map3DApp.MarkProvider.GetMyMap

get the current user's map, it will retrieve it if not loaded before. If loading failed it will create a new map as the current user map.

syntax

function Map3DApp.MarkProvider.GetMyMap()

Map3DApp.MarkProvider.SaveLocalMyMap

save map map to the default local file folder.

syntax

function Map3DApp.MarkProvider.SaveLocalMyMap()

Map3DApp.MarkProvider.NewMap


map to/from disk functions

create an empty map without any folder

syntax

function Map3DApp.MarkProvider.NewMap()

Map3DApp.MarkProvider.LoadMap

Load map from a file. return the map object. it may return nil if failed.

syntax

function Map3DApp.MarkProvider.LoadMap(filename)

parameters

filename  

Map3DApp.MarkProvider.SaveMap

save a map object to a given file.

  • param map : the map object
  • param filename : where to save the file.

syntax

function Map3DApp.MarkProvider.SaveMap(map, filename)

parameters

map the map object
filename  

the UI layer for drawing the marks according to the current view region.

Title the UI layer for drawing the marks according to the current view region.
Author(s) LiXizhi, Leio zhang, refactored by LiXizhi 2008.2.11
Date 2008/1/24
File script/kids/3DMapSystemUI/Map/SideBar/MarkUILayer.lua

Description

Member Functions

MarkButton:new

 the max number of cached mark buttons allowed
Map3DApp.MarkUILayer.MaxMarkDisplayed = 50;

 an array of cached MarkButton
local MarkList={};
Map3DApp.MarkUILayer.MapBrowserName=nil;

-----------------------------------------------
 Each mark button is associated with a UI object and a markInfo object. 
 Mark buttons are reused as many as possible when view region changed. 
-----------------------------------------------
local MarkButton = {
   -- the treeView mark Node associated with this button
   markNode=nil,
   -- name of UI objects associated with this button
   name=nil,
   -- this is increased by 1 on each frame move. so that we know when a button is last used. 
   counter = 0,
   -- private: automatically set for text display during rotation. 
   textOffset_X = 0,
   textOffset_Y = 0,
}
MarkButton = MarkButton;

syntax

function MarkButton:new(o)

parameters

o  

MarkButton:UpdateUI

update the UI object according to the markInfo. it does not update position.

  • param parentWnd : it can be nil. but passing it will speed up this function.

syntax

function MarkButton:UpdateUI(parentWnd)

parameters

parentWnd it can be nil. but passing it will speed up this function.

MarkButton:UpdatePosition

update the position and visibility

  • param pixelX :, pixelY: if nil, the button will be hidden
  • param parentWnd : it can be nil. but passing it will speed up this function.

syntax

function MarkButton:UpdatePosition(pixelX, pixelY, parentWnd)

parameters

pixelX , pixelY: if nil, the button will be hidden
pixelY  
parentWnd  

MarkButton.OnClickMark

[[ TODO: user clicks the mark, show a pop up UI mouse over: display balloon left click: zoom in and display dialog right click: display dialog ]]

syntax

function MarkButton.OnClickMark(btnName)

parameters

btnName  

Map3DApp.MarkUILayer.Init


mark UI layer.
call this function to bind the UI layer to the map window. It listens for ViewRegionChange event of the map window.

syntax

function Map3DApp.MarkUILayer.Init(MapBrowserName)

parameters

MapBrowserName  

Map3DApp.MarkUILayer:SetMessage

frame counter, increased by 1 for each OnViewRegionChange() call local counter = 0; event called when the view region is changed such as by panning and scaling the camera.

syntax

function Map3DApp.MarkUILayer:SetMessage(sender,msg,data)

parameters

sender  
msg  
data  

Map3DApp.MarkUILayer.UpdateMarkPosition


methods
update mark position
  • param counter : it is a counter increased by 1 during ViewRegionChange. We can use it to estimate when a node is added recently.

syntax

function Map3DApp.MarkUILayer.UpdateMarkPosition(counter)

parameters

counter it is a counter increased by 1 during ViewRegionChange. We can use it to estimate when a node is added recently.

Map3DApp.MarkUILayer.AddMark

add a new mark to the pool, it will reuse mark buton already in the pool if markInfo is the same.

  • param counter : it is a counter increased by 1 during ViewRegionChange. We can use it to estimate when a node is added recently.
  • return __ : it returns the mark button added or it will nil if pool is full. we should stop calling AddMark after the pool is full.

syntax

function  Map3DApp.MarkUILayer.AddMark(markNode,counter)

parameters

markNode  
counter it is a counter increased by 1 during ViewRegionChange. We can use it to estimate when a node is added recently.

Map3DApp.MarkUILayer.RemoveMark

remove marks whose markNode is the same as input

  • param markNode : the treeView mark Node

syntax

function Map3DApp.MarkUILayer.RemoveMark(markNode)

parameters

markNode the treeView mark Node

Map3DApp.MarkUILayer.ClearAll

clear all cached UI marks.

syntax

function Map3DApp.MarkUILayer.ClearAll()

Map3DApp.MarkUILayer.ToPixel

convert normalized world pt from [0-1] to pixel control position

syntax

function  Map3DApp.MarkUILayer.ToPixel(px,py)

parameters

px  
py  

display and edit MCML maps by the user or its friends, etc.

Title display and edit MCML maps by the user or its friends, etc.
Author(s) LiXizhi, Leio zhang, refactored by LiXizhi 2008.2.11
Date 2008/1/21
File script/kids/3DMapSystemUI/Map/SideBar/MyMapWnd.lua

Description

Member Functions

Map3DApp.MyMapWnd.DrawMyMapNodeHandler

maps tree view owner draw callback

syntax

function Map3DApp.MyMapWnd.DrawMyMapNodeHandler(_parent, treeNode)

parameters

parent  
treeNode  

Map3DApp.MyMapWnd.RenderCategoryNode

render a category node that can expand child nodes.

syntax

function Map3DApp.MyMapWnd.RenderCategoryNode(_parent,treeNode, left, top, width, height, textColor)

parameters

parent  
treeNode  
left  
top  
width  
height  
textColor  

Map3DApp.MyMapWnd.UpdateData


UI methods: add folder and mark node.

Update data from current settings.

syntax

function Map3DApp.MyMapWnd.UpdateData()

Map3DApp.MyMapWnd.AddFolderNode

add new folder node to a given map node

  • param mapNode : the map node to which the folder node is added.
  • param bUpdateUI : true to update UI.

syntax

function Map3DApp.MyMapWnd.AddFolderNode(mapNode, folderInfo, bUpdateUI)

parameters

mapNode the map node to which the folder node is added.
folderInfo  
bUpdateUI  

Map3DApp.MyMapWnd.AddMarkNode

add a new mark node to the given folder Node

syntax

function Map3DApp.MyMapWnd.AddMarkNode(folderNode, markInfo, bUpdateUI)

parameters

folderNode  
markInfo  
bUpdateUI  

Map3DApp.MyMapWnd.AppendMarkTemplatesToFolder

it will append a special mark templates as first child node at the given folder node if it has not been created before

  • param nodeFolder : the folder node
  • param bUpdateUI : true to update UI.

syntax

function Map3DApp.MyMapWnd.AppendMarkTemplatesToFolder(nodeFolder, bUpdateUI)

parameters

nodeFolder the folder node
bUpdateUI  

Map3DApp.MyMapWnd.IteratorNextVisibleMarkNode

return an iterator of visible markNode in the tree view. this will includes all marks in my maps, featured maps, and friends maps.

syntax

function Map3DApp.MyMapWnd.IteratorNextVisibleMarkNode()

Map3DApp.MyMapWnd.OnClickMapNode


event handlers
general map node onclick event

syntax

function Map3DApp.MyMapWnd.OnClickMapNode(treeNode)

parameters

treeNode  

Map3DApp.MyMapWnd.OnClickSyncMapNode


map event

syn the map with the remote server

syntax

function Map3DApp.MyMapWnd.OnClickSyncMapNode(sCtrlName, nodePath)

parameters

sCtrlName  
nodePath  

Map3DApp.MyMapWnd.OnClickDeleteMarkNode


mark event
user clicks to delete a mark inside a folder node.

syntax

function Map3DApp.MyMapWnd.OnClickDeleteMarkNode(sCtrlName, nodePath)

parameters

sCtrlName  
nodePath  

Map3DApp.MyMapWnd.OnCheckFolderNode


folder event
user checks to show/hide a map folder

syntax

function Map3DApp.MyMapWnd.OnCheckFolderNode(sCtrlName, nodePath)

parameters

sCtrlName  
nodePath  

Map3DApp.MyMapWnd.OnClickFolderEditMode

use clicks to edit the folder node.

syntax

function Map3DApp.MyMapWnd.OnClickFolderEditMode(sCtrlName, nodePath)

parameters

sCtrlName  
nodePath  

Map3DApp.MyMapWnd.OnClickEditFolder

show the folder editor dialog

syntax

function Map3DApp.MyMapWnd.OnClickEditFolder(sCtrlName, nodePath)

parameters

sCtrlName  
nodePath  

Map3DApp.MyMapWnd.OnClickAddFolder

add a folder to my map

syntax

function Map3DApp.MyMapWnd.OnClickAddFolder()

Map3DApp.MyMapWnd.OnClickDeleteFolderNode

user clicks to delete a folder inside a map node.

syntax

function Map3DApp.MyMapWnd.OnClickDeleteFolderNode(sCtrlName, nodePath)

parameters

sCtrlName  
nodePath  

Member Functions

Map3DApp.TileEditMediator.Init

========public method============

syntax

function Map3DApp.TileEditMediator.Init()

Map3DApp.TileEditMediator.OnFrameMsg

========private method===========

syntax

function Map3DApp.TileEditMediator.OnFrameMsg(msg,data)

parameters

msg  
data  

Map3DApp.TileEditMediator.OnPanelMsg

handle edit panel message

syntax

function Map3DApp.TileEditMediator.OnPanelMsg(msg)

parameters

msg  

Map3DApp.TileEditMediator.OnEditSceneMsg

handle edit scene message

syntax

function Map3DApp.TileEditMediator.OnEditSceneMsg(msg,data)

parameters

msg  
data  

Map3DApp.TileEditMediator.OnEditWndMsg

handle eidt window message

syntax

function Map3DApp.TileEditMediator.OnEditWndMsg(msg,data)

parameters

msg  
data  

Map3DApp.TileEditMediator.OnLandWndMsg

handle land window message

syntax

function Map3DApp.TileEditMediator.OnLandWndMsg(msg,data)

parameters

msg  
data  

Map3DApp.TileEditMediator.OnTileEditManagerMsg

handle tile edit manager message

syntax

function Map3DApp.TileEditMediator.OnTileEditManagerMsg(msg,data)

parameters

msg  
data  

Map3DApp.TileEditMediator.OnModelOfPageUpdate

on model of page call return

syntax

function Map3DApp.TileEditMediator.OnModelOfPageUpdate(modelInfos)

parameters

modelInfos  

Map3DApp.ModelPageManager.FirstPage

============ModelPageManager================== ModelPageManager = {}; ModelPageManager.totalPageCount = 0; ModelPageManager.activePageIndex = 0; ModelPageManager.dataPvd = DataPvd; ModelPageManager.frame = TileEditWnd;

=======public method==============

syntax

function Map3DApp.ModelPageManager.FirstPage()

Map3DApp.ModelPageManager.OnPageChange

========private method=============

syntax

function Map3DApp.ModelPageManager.OnPageChange()

edit panel

Title edit panel
Author(s) Lingfeng Sun
Date 2008/3/11
File script/kids/3DMapSystemUI/Map/SideBar/TileEditPanel.lua

Description

Member Functions

Map3DApp.TileEditPanel.Show

====private member===== TileEditPanel.name = "tileEditPanel"; TileEditPanel.parent = nil; TileEditPanel.onButtonClick = nil;

button name TileEditPanel.deleteBtn = TileEditPanel.name.."delete"; TileEditPanel.undoBtn = TileEditPanel.name.."undo"; TileEditPanel.redoBtn = TileEditPanel.name.."redo"; TileEditPanel.rightRotateBtn = TileEditPanel.name.."rRotate"; TileEditPanel.leftRotateBtn = TileEditPanel.name.."lRotate"; TileEditPanel.saveBtn = TileEditPanel.name.."save"; TileEditPanel.cancelBtn = TileEditPanel.name.."cancel";

=====public method======

syntax

function Map3DApp.TileEditPanel.Show(bShow)

parameters

bShow  

Map3DApp.TileEditPanel.Release

release all resource

syntax

function Map3DApp.TileEditPanel.Release()

Map3DApp.TileEditPanel.CreateUI

=======private==========

syntax

function Map3DApp.TileEditPanel.CreateUI()

Edit/view Tile dialog box

Title Edit/view Tile dialog box
Author(s) Leio zhang & Lingfeng Sun(refactor by Lingfeng Sun on 2.28)
Date 2008/2/22
File script/kids/3DMapSystemUI/Map/SideBar/TileEditWnd.lua

Description

Member Functions

Map3DApp.TileEditWnd.Show

public TileEditWnd.name = "tileEditWnd";

private TileEditWnd.x = 0; TileEditWnd.y = 0; TileEditWnd.width = 0; TileEditWnd.height = 0; TileEditWnd.parent = nil; TileEditWnd.bindingContext=nil; TileEditWnd.lastFilterType = nil; TileEditWnd.sideBarWidth = 282; TileEditWnd.modelInfoWnd = nil;

TileEditWnd.modelGridView = nil; TileEditWnd.modelInfoWnd = nil; TileEditWnd.listeners = {};

========public method=============== show tileEditWnd

syntax

function Map3DApp.TileEditWnd.Show(bShow)

parameters

bShow  

Map3DApp.TileEditWnd.Release

release all resource

syntax

function Map3DApp.TileEditWnd.Release()

Map3DApp.TileEditWnd.SetParent

set control parent

syntax

function Map3DApp.TileEditWnd.SetParent(_parent)

parameters

parent  

Map3DApp.TileEditWnd.SetPosition

set windows position

syntax

function Map3DApp.TileEditWnd.SetPosition(x,y)

parameters

x  
y  

Map3DApp.TileEditWnd.SwitchTabPage

=======private method================ create ui resource function CreateUI() local self = TileEditWnd; local _this,_parent,_rootParent;

_this = CreateUIObject("container",self.name,"_lt",self.x,self.y,self.width,self.height); if(self.parent ~= nil)then self.parent:AddChild(_this); else _this:AttachToRoot(); end _rootParent = _this;

--create edit scene container _this = CreateUIObject("container",self.name.."scene","_lt",5,5,541,546); _rootParent:AddChild(_this); _parent = _this;

NPL.load("(gl)script/kids/3DMapSystemUI/Map/Map3DAppTileEditScene.lua"); SetParent(_parent); TileEditScene.Show(bShow);

--side bar container _this = CreateUIObject("container",self.name.."sideBar","_rt",-self.sideBarWidth,4,self.sideBarWidth,self.height-8); _rootParent:AddChild(_this); _parent = _this;

--side bar tab page menu NPL.load("(gl)script/ide/MainMenu.lua"); _this = GetControl(self.name.."menu"); if(_this == nil)then _this = MainMenu:new{ name = self.name.."menu", alignment = "_lt", left = 10, top = 5, width = 200, height = 20, }; local node = _this.RootNode; node:AddChild(TreeNode:new({Text = "妯″瀷", Name = "model", onclick = SwitchTabPage})); node:AddChild(TreeNode:new({Text = "灞炴€?, Name = "property", onclick = SwitchTabPage})); end _this.parent = _parent; _this:Show(true); OnClickTopLevelMenuItem(self.name.."menu",1);

--===================model edit page======================= _this = CreateUIObject("container",self.name.."modelEditPage","_lt",0,25,self.sideBarWidth-4,self.height-33); _this.fastrender = false; _parent:AddChild(_this); _parent = _this;

--model type filter NPL.load("(gl)script/ide/dropdownlistbos.lua"); _this = GetControl(self.name.."filter"); if(_this == nil)then _this = CommonCtrl.dropdownlistbox:new{ name = self.name.."filter", alignment = "_rt", left = -140, top = 6, width = 130, height = 20, dropdownheight = 106, text = "", items = {"寤虹瓚", "浜虹墿鏍囪", "浜嬩欢鏍囪" }, onselect = "Map3DApp.TileEditWnd.OnUIMsg(TileEditWnd.Msg.filterChange)"; }; end; _this.parent = _parent; _this:Show();

NPL.load("(gl)script/kids/3DMapSystemUI/Map/SideBar/GridView.lua"); self.modelGridView = ImageGridView:new{ name = self.name.."modelGV", left = 0, top = 27, width = self.sideBarWidth-4, height = 260, cellWidth = 80, cellHeight = 80, cellSpaceX = 4, parent = _parent; maxCellCount= 9, onCellClick = OnModelSelect; }; self.modelGridView:Show(true); self.modelGridView:RefreshCells();

--display page index _this = CreateUIObject("text",self.name.."pageIndex","_rt",-180,290,50,23); _this.text = "1/1"; _parent:AddChild(_this);

_this = CreateUIObject("button", self.name.."prePageBtn", "_rt", -135, 290, 60, 16) _this.text = "涓婁竴椤?; _this.onclick=";Map3DApp.TileEditWnd.OnPageDown();"; _parent:AddChild(_this);

_this = CreateUIObject("button", self.name.."nextPageBtn", "_rt", -70, 290, 60, 16) _this.text = "涓嬩竴椤?; _this.onclick=";Map3DApp.TileEditWnd.OnPageUp();"; _parent:AddChild(_this);

--model infomation window if(not self.modelInfoWnd)then NPL.load("(gl)script/kids/3DMapSystemUI/Map/Map3DAppModelInfoWnd.lua"); self.modelInfoWnd = ModelInfoWnd:new{ name = self.name.."modelInfoWnd", alignment = "_lt", left = 0, top = 320, width = self.sideBarWidth - 4, height = 200, parent = _parent; } end self.modelInfoWnd:SetParent(_parent); self.modelInfoWnd:Show(true);

--=================tile property edit page================= _parent = GetUIObject(self.name.."sideBar") _this = CreateUIObject("container",self.name.."tilePropertyPage","_lt",0,25,self.sideBarWidth-4,self.height-33); _this.visible = false; _parent:AddChild(_this); _parent = _this;

--_this = CreateUIObject("text","s","_lt",6,15,80,12); --_this.text = "鍦熷湴鍚嶇О:"; --_parent:AddChild(_this); -- --_this = CreateUIObject("imeeditbox",self.name.."ownerName","_lt",75,15,120,20); --_this.text = "none..."; --_parent:AddChild(_this);

--==================tabpage switch menu====================

end

syntax

function Map3DApp.TileEditWnd.SwitchTabPage(treeNode)

parameters

treeNode  

Map3DApp.TileEditWnd.OnUIMsg

ui event handler function----------------

syntax

function Map3DApp.TileEditWnd.OnUIMsg(msg,data1)

parameters

msg  
data1  
Topic revision: r1 - 2008-02-29 - LiXizhi
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback