/// <summary>
        /// Have the editor to update the theme on the layer object.
        /// </summary>
        public void UpdateValues()
        {
            if (newLayer != null)
            {
                // remove the auto style from this layer
                layer.styleitem = null;

                while (layer.numclasses > 0)
                {
                    layer.removeClass(layer.numclasses - 1);
                }

                for (int i = 0; i < newLayer.numclasses; i++)
                {
                    classObj classobj = newLayer.getClass(i).clone();
                    // bindings are not supported with sample maps
                    for (int s = 0; s < classobj.numstyles; s++)
                    {
                        StyleBindingController.RemoveAllBindings(classobj.getStyle(s));
                    }
                    for (int l = 0; l < classobj.numlabels; l++)
                    {
                        LabelBindingController.RemoveAllBindings(classobj.getLabel(l));
                    }
                    layer.insertClass(classobj, -1);
                }

                if (target != null)
                {
                    target.RaisePropertyChanged(this);
                }
            }
        }
Example #2
0
    public void testRemoveClassObj()
    {
        mapObj   map      = new mapObj(mapfile);
        layerObj layer    = map.getLayer(1);
        classObj newClass = new classObj(null);

        layer.insertClass(newClass, 0);
        layer.removeClass(0);

        map = null; layer = null;
        gc();
        assert(newClass.refcount == 1, "testRemoveClassObj");
    }