Пример #1
0
    public void testClassObjDestroy()
    {
        mapObj   map       = new mapObj(mapfile);
        layerObj layer     = map.getLayer(1);
        classObj newClass  = new classObj(layer);
        classObj reference = layer.getClass(layer.numclasses - 1);

        assert(newClass.refcount == 3, "testClassObjDestroy precondition");
        newClass.Dispose();         // force the destruction for Mono on Windows because of the constructor overload
        map = null; layer = null; newClass = null;
        gc();
        assert(reference.refcount == 2, "testClassObjDestroy");
    }
Пример #2
0
	public void testInsertClassObjDestroy() 
	{
		mapObj map=new mapObj(mapfile);
		layerObj layer=map.getLayer(1);
		classObj newClass=new classObj(null);
		layer.insertClass(newClass,0);
		classObj reference = layer.getClass(0);

		assert(newClass.refcount == 3, "testInsertClassObjDestroy precondition");
		newClass.Dispose(); // force the destruction for Mono on Windows because of the constructor overload
		map=null; layer=null; newClass=null;
		gc();
		assert(reference.refcount == 2, "testInsertClassObjDestroy");
	}
Пример #3
0
        /// <summary>
        /// show all the predefined symbols
        /// </summary>
        private void LoadSymbolFromLib()
        {
            classObj pClass = new classObj(null);
            styleObj pStyle = new styleObj(pClass);

            colorObj pColor = new colorObj(0,0,0,0);

            int iSymbolCount = m_pDefaultMap.getNumSymbols();

            symbolSetObj pSymSet = m_pDefaultMap.symbolset;

            for(int i=1;i < iSymbolCount;i++)
            {
                pStyle.symbol = i;
                pStyle.color = pColor;

                symbolObj pSymbol = pSymSet.getSymbol(i);

                if (m_LayerType == MS_LAYER_TYPE.MS_LAYER_POINT)
                {
                    //type cartoline if only for line type
                    if (pSymbol.type == (int)MS_SYMBOL_TYPE.MS_SYMBOL_CARTOLINE)
                        continue;

                    pStyle.size = 10;
                    pStyle.angle = 0;
                }
                else if (m_LayerType == MS_LAYER_TYPE.MS_LAYER_LINE)
                {
                    pStyle.size = 6;
                    pStyle.width = 1;
                }
                else if (m_LayerType == MS_LAYER_TYPE.MS_LAYER_POLYGON)
                {
                    //type cartoline if only for line type
                    if (pSymbol.type == (int)MS_SYMBOL_TYPE.MS_SYMBOL_CARTOLINE)
                        continue;

                    pStyle.size = 8;
                    pStyle.outlinewidth = 1;
                    pStyle.outlinecolor = pColor;
                }

                imageListPreview.Images.Add(GetImageFromClass(pClass, 48, 48));

                listViewSymbol.Items.Add(pSymbol.name, imageListPreview.Images.Count - 1);
            }

            pStyle.Dispose();
            pClass.Dispose();
            pColor.Dispose();
        }