Ok, I' m going to explain you what I am doing:
I am adding a new class MovePoint to create a button with a new
functionality. It is, when I push the button to query a city, I want to move
the city, and then save the changes into the server.
My new class is:
mapbuilder.loadScript(baseDir+"/widget/EditButtonBase.js");
function MovePoint(widgetNode, model) {
// Extend EditButtonBase
EditButtonBase.apply(this, new Array(widgetNode, model));
this.loadDefaultModel = function(objRef) {
var str = new XMLSerializer().serializeToString(
objRef.targetModel.doc.selectSingleNode('//gml:featureMember'));
var doc = Sarissa.getDomDocument();
objRef.targetModel.doc = (new DOMParser()).parseFromString(str,
"text/xml");
alert("objRef.targetModel.doc" + objRef.targetModel.doc);
objRef.targetModel.setParam('refresh');
}
/**
* Add a point to the enclosing GML model.
* @param objRef Pointer to this object.
* @param targetNode The node for the enclosing HTML tag for this widget.
*/
this.doAction = function(objRef,targetNode) {
if (objRef.enabled) {
point=objRef.mouseHandler.model.extent.getXY(targetNode.evpl);
sucess=objRef.targetModel.setXpathValue(objRef.targetModel,
objRef.featureXpath,point[0]+","+point[1]);
}
}
}
and config.xml file is:
<MovePoint id="movePoint">
<!--<scriptFile>MovePoint.js</scriptFile>-->
<buttonBar>mainButtonBar</buttonBar>
<targetModel>featureCollection</targetModel>
<mouseHandler>mainMouseClick</mouseHandler>
<class>RadioButton</class>
<enabledSrc>/images/MovePointEnable.gif</enabledSrc>
<disabledSrc>/images/MovePointEnable.gif</disabledSrc>
<transactionResponseModel>transaction</transactionResponseModel>
<webServiceUrl>../wfs</webServiceUrl>
<targetContext>mainMap</targetContext>
<featureXpath>/gml:featureMember/topp:tasmania_cities/topp:the_geom/gml:MultiPoint/gml:pointMember/gml:Point/gml:coordinates</featureXpath>
<defaultModelUrl>template_cities.xml</defaultModelUrl>
</MovePoint>
and the namespaces label is:
<namespace>xmlns:gml='http://www.opengis.net/gml' xmlns:wfs='
http://www.opengis.net/wfs' xmlns:topp='http://www.openplans.org/topp'
</namespace>
Thanks for your help
2007/6/11, Luca Giandoso <[EMAIL PROTECTED]>:
If you post some code we can help you better...
Luca Giandoso
On 6/11/07, César <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've check objRef.featureXpath, and the namespaces, in fact it is used
the
> same namespaces that editpoint widget, and I have no troubles with
> editpoint. Apart from config.xml, do you know others files where
namespaces
> label is modified?
>
> Thanks
>
> 2007/6/9, Luca Giandoso <[EMAIL PROTECTED]>:
> > Check objRef.featureXpath, maybe the namespaces are not correct.
> >
> > Luca Giandoso
> >
> > On 6/8/07, César <[EMAIL PROTECTED]> wrote:
> > > Hi,
> > >
> > > I've an error code 14:An attempt was made to create or change an
object
> in a
> > > way which is incorrect with regard to namespaces. when I try to do
> > >
> objRef.targetModel.getXpathValue(objRef.targetModel,objRef.featureXpath
).
> > > Do anybody knows what could be the matter? If not, Can anybody tells
me
> > > where the getXpathValue function is defined?
> > >
> > > As you can see, the problem is with the namespaces, but I think all
my
> > > namespaces are right, because the editpoint button works well.
> > >
> > > I'll be greatful with somebody who can help me.
> > >
> > > Thanks very much.
> > >
> > >
>
-------------------------------------------------------------------------
> > > This SF.net email is sponsored by DB2 Express
> > > Download DB2 Express C - the FREE version of DB2 express and take
> > > control of your XML. No limits. Just data. Click to get it now.
> > > http://sourceforge.net/powerbar/db2/
> > > _______________________________________________
> > > mapbuilder-devel mailing list
> > > [email protected]
> > >
> https://lists.sourceforge.net/lists/listinfo/mapbuilder-devel
> > >
> > >
> >
>
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
mapbuilder-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mapbuilder-devel