/* * Class: mapnik_FeatureSet * Method: dealloc * Signature: (JJ)V */ JNIEXPORT void JNICALL Java_mapnik_FeatureSet_dealloc (JNIEnv *env, jobject, jlong fsptr, jlong fptr) { if (fsptr) delete static_cast<mapnik::featureset_ptr*>(TO_POINTER(fsptr)); if (fptr) delete static_cast<mapnik::feature_ptr*>(TO_POINTER(fptr)); }
/* * Class: mapnik_Layer * Method: dealloc * Signature: (J)V */ JNIEXPORT void JNICALL Java_mapnik_Layer_dealloc (JNIEnv *env, jclass c, jlong ptr) { if (ptr) { delete static_cast<mapnik::layer*>(TO_POINTER(ptr)); } }
JNIEXPORT void JNICALL Java_OpenGL_GLUQuadric_cylinder (JNIEnv *env, jobject obj, jlong quadric, jdouble baseRadius, jdouble topRadius, jdouble height, jint slices, jint stacks) { gluCylinder(TO_POINTER(quadric), baseRadius, topRadius, height, slices, stacks); }
/* * Class: mapnik_Image * Method: dealloc * Signature: (J)J */ JNIEXPORT void JNICALL Java_mapnik_Image_dealloc (JNIEnv * env, jclass c, jlong ptr) { mapnik::image_32* im=static_cast<mapnik::image_32*>(TO_POINTER(ptr)); if (im) { delete im; } }
JNIEXPORT void JNICALL Java_OpenGL_GLUQuadric_partialDisk (JNIEnv *env, jobject obj, jlong quadric, jdouble innerRadius, jdouble outerRadius, jint slices, jint loops, jdouble startAngle, jdouble sweepAngle) { gluPartialDisk(TO_POINTER(quadric), innerRadius, outerRadius, slices, loops, startAngle, sweepAngle); }
/* * Class: mapnik_FeatureTypeStyle * Method: dealloc * Signature: (J)V */ JNIEXPORT void JNICALL Java_mapnik_FeatureTypeStyle_dealloc (JNIEnv *env, jobject, jlong ptr) { PREAMBLE; mapnik::feature_type_style* style=static_cast<mapnik::feature_type_style*>(TO_POINTER(ptr)); delete style; TRAILER_VOID; }
/* * Class: mapnik_MapDefinition * Method: dealloc * Signature: (J)V */ JNIEXPORT void JNICALL Java_mapnik_MapDefinition_dealloc (JNIEnv *env, jobject, jlong ptr) { PREAMBLE; if (ptr) { delete static_cast<mapnik::Map*>(TO_POINTER(ptr)); } TRAILER_VOID; }
/* * Class: mapnik_MapDefinition * Method: copy * Signature: (J)J */ JNIEXPORT jlong JNICALL Java_mapnik_MapDefinition_copy (JNIEnv *env, jclass c, jlong otherPtr) { if (!otherPtr) return 0; PREAMBLE; mapnik::Map* other=static_cast<mapnik::Map*>(TO_POINTER(otherPtr)); mapnik::Map* m=new mapnik::Map(*other); return FROM_POINTER(m); TRAILER(0); }
/* * Class: mapnik_MapDefinition * Method: addLayer * Signature: (Lmapnik/Layer;)V */ JNIEXPORT void JNICALL Java_mapnik_MapDefinition_addLayer (JNIEnv *env, jobject mapobject, jobject layerobject) { if (!layerobject) return; PREAMBLE; mapnik::Map* map=LOAD_MAP_POINTER(mapobject); mapnik::layer* layer= static_cast<mapnik::layer*>(TO_POINTER(env->GetLongField(layerobject, FIELD_PTR))); map->addLayer(*layer); TRAILER_VOID; }
/* * Class: mapnik_MapDefinition * Method: addStyle * Signature: (Ljava/lang/String;Lmapnik/FeatureTypeStyle;)V */ JNIEXPORT void JNICALL Java_mapnik_MapDefinition_addStyle (JNIEnv *env, jobject mapobject, jstring namej, jobject styleobject) { PREAMBLE; if (!styleobject) return; mapnik::Map* map=LOAD_MAP_POINTER(mapobject); refjavastring name(env, namej); mapnik::feature_type_style* style=static_cast<mapnik::feature_type_style*>( TO_POINTER(env->GetLongField(styleobject, FIELD_PTR)) ); map->insert_style(name.stringz, *style); TRAILER_VOID; }
/* * Class: mapnik_Layer * Method: setDatasource * Signature: (Lmapnik/Datasource;)V */ JNIEXPORT void JNICALL Java_mapnik_Layer_setDatasource (JNIEnv *env, jobject layerobj, jobject dsobject) { mapnik::layer* layer=LOAD_LAYER_POINTER(layerobj); if (!dsobject) { layer->set_datasource(mapnik::datasource_ptr()); return; } mapnik::datasource_ptr* dspinned= static_cast<mapnik::datasource_ptr*>( TO_POINTER(env->GetLongField(dsobject, CLASS_DATASOURCE.ptr_field))); layer->set_datasource(*dspinned); }
/* * Class: mapnik_MapDefinition * Method: setLayer * Signature: (ILmapnik/Layer;)V */ JNIEXPORT void JNICALL Java_mapnik_MapDefinition_setLayer (JNIEnv *env, jobject mapobject, jint index, jobject layerobject) { PREAMBLE; mapnik::Map* map=LOAD_MAP_POINTER(mapobject); std::vector<mapnik::layer> &layers(map->layers()); if (index<0 || ((unsigned)index)>layers.size()) { return; } if (!layerobject) return; mapnik::layer* layer= static_cast<mapnik::layer*>(TO_POINTER(env->GetLongField(layerobject, FIELD_PTR))); layers[index]=*layer; TRAILER_VOID; }
/* * Class: mapnik_Layer * Method: setDatasource * Signature: (Lmapnik/Datasource;)V */ JNIEXPORT void JNICALL Java_mapnik_Layer_setDatasource (JNIEnv *env, jobject layerobj, jobject dsobject) { PREAMBLE; mapnik::layer* layer=LOAD_LAYER_POINTER(layerobj); if (!dsobject) { layer->set_datasource(mapnik::datasource_ptr()); return; } mapnik::datasource_ptr* dspinned= static_cast<mapnik::datasource_ptr*>( TO_POINTER(env->GetLongField(dsobject, FIELD_PTR))); layer->set_datasource(*dspinned); TRAILER_VOID; }
JNIEXPORT void JNICALL Java_OpenGL_GLUQuadric_sphere (JNIEnv *env, jobject obj, jlong quadric, jdouble radius, jint slices, jint stacks) { gluSphere(TO_POINTER(quadric), radius, slices, stacks); }
void c_port_write(char *buffer, Word size) { /* ************************************************************** * * No local variables... * * ************************************************************** */ /* ************************************************************** * * Now lets see if it looks like we are allowed to be printing...* * Check for the following: * * 1) We are at level 1 for spool files... * * 2) We have an open spool file * * 3) No errors have occured (yet) * * ************************************************************** */ if ((open_count != 1) || (data_file_ptr == (KS_FILE_PTR) NULL) || (port_status != PORT_SPOOLING)) { return; }; /* ************************************************************** * * Looks good... write this data to the buffered output file. * * Remember to check for an error... * * ************************************************************** */ KS_FILE_WRITE(data_file_ptr, KS_NEXT_FILE_POSITION, (LongWord) size, TO_POINTER(buffer), error); if (error != KS_E_SUCCESS) { error_message = CANT_WRITE_DATA; goto ERROR_CANT_WRITE_DATA; }; /* ************************************************************** * * Everything is all done here - return to our caller... * * ************************************************************** */ return; /* ************************************************************** * * Error processing for all of the error cases of the above code * * * * Something bad happened... that means we have to give up * * on printing and give our user an error dialog that tells * * them what happened. * * ************************************************************** */ ERROR_CANT_WRITE_DATA: /* ************************************************************** * * First we close the spool file (can't use it anymore now...) * * then give our user some feed back (like an error message). * * ************************************************************** */ KS_FILE_CLOSE(data_file_ptr, error2); data_file_ptr = (KS_FILE_PTR) NULL; open_count--; port_status = PORT_ERROR; ERROR_DIALOG(error_message, error, button); return; }
JNIEXPORT void JNICALL Java_OpenGL_GLUQuadric_quadricTexture (JNIEnv *env, jobject obj, jlong quadric, jboolean texture) { gluQuadricTexture(TO_POINTER(quadric), texture); }
JNIEXPORT void JNICALL Java_OpenGL_GLUQuadric_quadricNormals (JNIEnv *env, jobject obj, jlong quadric, jint normals) { gluQuadricNormals(TO_POINTER(quadric), normals); }
JNIEXPORT void JNICALL Java_OpenGL_GLUQuadric_quadricOrientation (JNIEnv *env, jobject obj, jlong quadric, jint orientation) { gluQuadricOrientation(TO_POINTER(quadric), orientation); }
/* Set the drawing style for the quadric. */ JNIEXPORT void JNICALL Java_OpenGL_GLUQuadric_quadricDrawStyle (JNIEnv *env, jobject obj, jlong quadric, jint drawStyle) { gluQuadricDrawStyle(TO_POINTER(quadric), drawStyle); }
/* Deletes a quadric. */ JNIEXPORT void JNICALL Java_OpenGL_GLUQuadric_deleteQuadric (JNIEnv *env, jobject obj, jlong quadric) { gluDeleteQuadric((GLUquadric*)(TO_POINTER(quadric))); }
JNIEXPORT void JNICALL Java_OpenGL_GLUQuadric_disk (JNIEnv *env, jobject obj, jlong quadric, jdouble innerRadius, jdouble outerRadius, jint slices, jint loops) { gluDisk(TO_POINTER(quadric), innerRadius, outerRadius, slices, loops); }
KS_E_ERROR ks_file_write(KS_FILE_PTR file_ptr, LongWord position, LongWord data_size, Pointer data_buffer) { /* ************************************************************** * * Local declarations: * * ************************************************************** */ KS_E_ERROR error; /* Holds error codes for subroutine*/ /* calls */ LongWord data_offset; /* Offset into the buffer to return*/ LongWord remaining_space; /* Space remaining in file buffer */ LongWord buffer_request; /* Size of each copy from the */ /* file buffer */ ROUTINE_ENTER(); /* ************************************************************** * * Verify the structure ID passed in is the correct one. * * ************************************************************** */ if (file_ptr->struct_id != KS_FILE_ID) { KS_ERROR(KS_E_INVALID_STRUCT_ID, KS_FILE_ID); }; /* ************************************************************** * * Zero the number of bytes transfered in the KS_FILE structure. * * ************************************************************** */ file_ptr->data_size = 0; /* ************************************************************** * * If there is a buffer, then lets put data into the file buffer.* * ************************************************************** */ if (file_ptr->buffer_size != NULL) { /* ********************************************************** * * Loop till we satisfy the request (or take an error) * * ********************************************************** */ data_offset = 0; while (data_size > 0) { /* ****************************************************** * * Calculate the remaining space in the buffer. If * * there is any space left in the buffer then lets copy * * as much as we need to into the file buffer. * * ****************************************************** */ remaining_space = (file_ptr->buffer_available) - (file_ptr->buffer_offset); if (remaining_space > 0) { buffer_request = MIN(data_size, remaining_space); COPY_BYTES(data_buffer, data_offset, file_ptr->buffer, file_ptr->buffer_offset, buffer_request); /* ************************************************** * * Now modify the parameters of the buffers by: * * * * 1) Adding the size of the request to the file * * buffer ofset and the data offset (IE: Indices to * * the file buffer and the read request buffer). * * * * 2) Subtracting the request size from the read * * request size and the remaining number of * * characters in the file buffer. * * ************************************************** */ file_ptr->buffer_offset = file_ptr->buffer_offset + buffer_request; data_offset = data_offset + buffer_request; file_ptr->data_size = data_offset; data_size = data_size - buffer_request; remaining_space = remaining_space - buffer_request; }; /* ****************************************************** * * If the file buffer is full, then we have to write it * * to disk. The problem is that the buffer size may * * have changed due to what our user wants (users are * * bound to be the end of all computing...). This means * * that we'll junp through a few hoops if we must change * * buffer sizes - so expect some weirdness here. * * ****************************************************** */ if (remaining_space == 0) { /* ************************************************** * * Issue a Read to the file into our buffer. * * ************************************************** */ KSf_pkts.IO.pCount = 4; KSf_pkts.IO.refNum = file_ptr->refNum; KSf_pkts.IO.dataBuffer = TO_POINTER(file_ptr->buffer); KSf_pkts.IO.requestCount = file_ptr->buffer_size; WriteGS(&KSf_pkts.IO); if ((error = GET_ERROR()) != KS_E_SUCCESS) { goto EXIT_NOW; }; file_ptr->buffer_available = file_ptr->buffer_size; file_ptr->buffer_offset = 0; /* ************************************************** * * This is the above mentioned weirdness - if the * * user specified a different size buffer we will * * no comply with their wishes. * * ************************************************** */ if (file_ptr->buffer_size != KSf_FileBufferSize) { KS_MEMORY_DEALLOCATE(file_ptr->buffer_handle, error); if (error != KS_E_SUCCESS) { goto EXIT_NOW; }; KS_MEMORY_ALLOCATE(attrFixed + attrLocked, KSf_FileBufferSize, BUFFER_USERID, file_ptr->buffer_handle, error); if (error != KS_E_SUCCESS) { goto EXIT_NOW; }; file_ptr->buffer = (Byte *) *(file_ptr->buffer_handle); file_ptr->buffer_size = KSf_FileBufferSize; file_ptr->buffer_available = KSf_FileBufferSize; }; }; /* End if there is no remaining buffer space */ }; /* End while there are characters to be read... */ KS_SUCCESS(); }; /* End if we are doing buffer I/O from the file */ /* ************************************************************** * * Ok, we've done enough buffering... lets do some real output...* * * * Position the 'mark' (where we will write to) in the file. * * Note: We'll move the mark only if our user asks us to. * * ************************************************************** */ if (position != KS_NEXT_FILE_POSITION) { KSf_pkts.position.pCount = 3; KSf_pkts.position.refNum = file_ptr->refNum; KSf_pkts.position.base = startPlus; KSf_pkts.position.displacement = position; SetMarkGS(&KSf_pkts.position); if ((error = GET_ERROR()) != KS_E_SUCCESS) { goto EXIT_NOW; }; }; /* End if we must change the file position */ /* ************************************************************** * * Setup the I/O packet and write what our user is asking for. * * ************************************************************** */ KSf_pkts.IO.pCount = 4; KSf_pkts.IO.refNum = file_ptr->refNum; KSf_pkts.IO.dataBuffer = data_buffer; KSf_pkts.IO.requestCount = data_size; WriteGS(&KSf_pkts.IO); if ((error = GET_ERROR()) != KS_E_SUCCESS) { goto EXIT_NOW; }; /* ************************************************************** * * Save the number of bytes transfered in the KS_FILE structure. * * ************************************************************** */ file_ptr->data_size = KSf_pkts.IO.transferCount; /* ************************************************************** * * Return the status back to our caller. * * ************************************************************** */ EXIT_NOW: if (error != KS_E_SUCCESS) { KS_ERROR(error, KS_FILE_ID); }; KS_SUCCESS(); } /* End of ks_file_write() */
/* * Class: mapnik_FeatureTypeStyle * Method: dealloc * Signature: (J)V */ JNIEXPORT void JNICALL Java_mapnik_FeatureTypeStyle_dealloc (JNIEnv *env, jclass c, jlong ptr) { mapnik::feature_type_style* style=static_cast<mapnik::feature_type_style*>(TO_POINTER(ptr)); delete style; }